ngRepeat makes it easy to iterate over Array/Objects in AngularJS. ngRepeat iterates using Array/Object values, which can cause problem, if there are duplicate values in Array/Object e.g. [1, 1, 2, 3, 4, 4]. To iterate Array/Object with duplicate value in ngRepeat, we can define what will be used by ngRepeat to iterate over Array/Object, e.g. Array key. Check example below:
<div ng-repeat="row in [1, 1, 2, 3, 4, 4] track by $index">
  <!-- Do some stuff here. -->
</div>
In above code, ngRepeat will iterate using $index that is Array key in this case.

Reference:

Tags
Submitted by ychaugule on