Reputation: 825
I have this plunk:
http://plnkr.co/edit/7X8VMG?p=preview
and when I filter by clicking "Uncompleted" I'm getting the duplicates error in repeater
Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: node in nodes track by node.id, Duplicate key: 1441, Duplicate value: {"name":"1","id":1441,"created_at":...
But if you look to the code, there is only one node with ID 1441. I've tried to put there others track by options, but nothing worked.
//Update info: Track by $index doesn't work because of nested structure
How to fix it?
Thanks a lot!
David
Upvotes: 0
Views: 746
Reputation: 825
There was an error in setFilterOptions function that there was more status with same code and then it pushed more often the node to the result array.
fixed by
if($scope.current_visibility.since === null) {
$scope.filters.tasks.statuses = angular.copy($scope.active_statusses);
$scope.filters.tasks.statuses.push($scope.folder_status);
}
Thanks for help
Upvotes: 0
Reputation: 1837
track by $index
should do the trick, even with a nested structure, since $index will refer to the index on the innermost ngRepeat scope.
This will cause the items to be keyed by their position in the array instead of their value
Upvotes: 0