This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
ng-repeat throws "Duplicates in a repeater" iterating over an object with identical values #2787
Closed
Description
Using
ng-repeat="(key,value) in myObj"
where myObj = {
age: "20",
children: "20"
}
throws "Duplicates in a repeater" error, because the default 'trackByIdFn' is calling hasKey with only the value (not the key). The generated hashes for both myObj.age and myObj.children end up as "string:20", which trips up ng-repeat.
Perhaps trackByIdFn should handle strings/numbers explicitly and use hashKey(key + value) for them? Not sure what else this impacts however.
Metadata
Metadata
Assignees
Labels
No labels