When developing web applications, we often need to use ng repeat to traverse the array in $scope to update the list elements in the view
when the elements in our array are repeated, the browser will report such an error in the console
$scope.array=[1, 1, 1, 1, 2];
Error: [ngR epeat:dupes ]
Because angularjs forbids the repetition of elements in the array in ng repeat, we usually use track by $index to solve this problem
$scope.number=[1, 1, 1, 1, 2];
ng-repeat=”n in number track by $index”
The duplicate values here refer to the original values. If we use objects to represent them, there will be no errors. For example, the number object:
$scope.number=[new Number(2), new Number(2), new Number(2)];
String object:
$scope.number=[new String(2), new String(2), new String(2)];
Similar Posts:
- Angular JS ng-repeat Error: [ngRepeat:dupes]
- AngluarJs Error: [ngR epeat:dupes ]Solutions
- cannot simultaneously fetch multiple bags
- Solutions to the exception of cannot simply fetch multiple bags
- The Usage of Numpy.unravel_index() function
- How to Use Array.prototype.slice.call(arguments)
- tf.data.Dataset.from_tensor_slices: How to Use shuffle(), repeat(), batch()
- [Solved] Tensorflow Error: ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray)
- Occlusion problem of SVG Z-index layer
- Django: How to Convert Models object to JSON