I am defining a custom filter like so:
-
The solution is actually described here: http://www.anujgakhar.com/2013/06/15/duplicates-in-a-repeater-are-not-allowed-in-angularjs/
AngularJS does not allow duplicates in a ng-repeat directive. This means if you are trying to do the following, you will get an error.
// This code throws the error "Duplicates in a repeater are not allowed.
// Repeater: row in [1,1,1] key: number:1"
However, changing the above code slightly to define an index to determine uniqueness as below will get it working again.
// This will work
Official docs are here: https://docs.angularjs.org/error/ngRepeat/dupes
- 热议问题