You can track by $index if your data source has duplicate identifiers
for example: $scope.dataSource: [{id:1,name:'one'}, {id:1,name:'one too'}, {id:2,name:'two'}]
You cannot iterate over this collection when using the id id as an id (duplicate id: 1).
DOES NOT WORK:
<element ng-repeat="item.id as item.name for item in dataSource"> // something with item ... </element>
but you can using track by $index :
<element ng-repeat="item in dataSource track by $index"> // something with item ... </element>
nilsK Mar 31 '14 at 12:28 2014-03-31 12:28
source share