0

I want to ask you if you can help me to dynamiclly attribute ng-model name to an input radio in HTML table, using ng-repeat,

this my code

            <tbody>
                <tr ng-if="$index>0" ng-repeat="row in resultatfinal">
                    <td ng-repeat="k in  [] | range:collumnLength">{{ row [$index] }}</td>
                    <td ng-repeat="i in  [] | range:3"><input type="radio" ng-model="i" value="i" /> </td>
                </tr>
            </tbody>

i would like to attribut name like

    inputradio11 for the firt radio input in the first row
    inputradio12 for the firt radio input in the first row
    inputradio13 for the firt radio input in the first row

     inputradio21 for the firt radio input in the second row

thank you

2
  • can you provide jsfiddle? Commented Nov 28, 2014 at 17:51
  • if you resolve your problem, you can add your solution as answer, or delete question Commented Dec 1, 2014 at 9:36

1 Answer 1

0

this is the solution, i have juste used the id of the parent with $parent.$index to the indice of row, column indice i have the i var

            <tbody>
                <tr ng-if="$index>0" ng-repeat="row in resultatfinal">
                    <td ng-repeat="k in [] | range:collumnLength">{{ row [$index] }}</td>
                    <td ng-repeat="i in [] | range:3"><input type="radio" name="{{$parent.$index}}{{i}}" value="{{i}}" /></td>
                </tr>
            </tbody>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.