How to set the model name dynamically in ng-repeat loop
<div ng-controller="parentController">
<div ng-ccontroller="childController">
<div data-ng-repeat="category in categories">
<label >{{category.name}}</label>
<div class="radio">
<label><input type="radio" name=? value="1" ng-model=?> value 1</label>
<label><input type="radio" name=? value="2" ng-model="?"> value 1</label>
</div>
</div>
</div>
</div>
Here in above I have to set name and ng-model values dynamically Like $parent.cat0,$parent.cat1,$parent.cat2 of parent controller whenever loop through happens.
I tried the following:
ng-model = '$parent.cat'+{{$index}}
or
ng-model = "'$parent.cat1'+{{$index}}"
or
ng-model = "$parent.cat"+{{$index}}
I tried the above things nothing worked out. Is there any other method to set the model name dynamically in angular js.
I am expecting somethong like this (given in normal html)
<label>category1</label>
<input type="radio" name ="cat1" value=0>value0</input>
<input type="radio" name ="cat1" value=1>value1</input>
<label>category2</label>
<input type="radio" name ="cat2" value=0>value0</input>
<input type="radio" name ="cat2" value=1>value1</input>