Reputation: 525
I'm looking to increment my input ID while using ng-repeat and I tried this but it doesn't work :
<div ng-repeat="d in index">
<input type="checkbox" name="name" value="" id="{{d}}" ng-model="{{d}}"/>
</div>
Do you have any ideas about how to do it?
Upvotes: 3
Views: 276
Reputation: 3756
Try This
<div ng-repeat="d in index track by $index">
<input type="checkbox" name="name" value="" id="{{$index}}" ng-model="d"/>
</div>
Upvotes: 1
Reputation: 469
you can track by $index your ng-repeat
div ng-repeat="d in index track by $index"
input type="checkbox" name="name" value="" id="{{$index}}" ng-model="{{d}}"/
/div
Upvotes: 2