Skip to content
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
@worrel

Description

@worrel

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions