Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/content/error/ngRepeat/dupes.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
@name ngRepeat:dupes
@fullName Duplicate Repeater Key
@description

Occurs if there are duplicate keys in an ng-repeat expression. Duplicate keys are banned because AngularJS uses keys to associate DOM nodes with items.

By default, collections are keyed by value, so ng-repeat="value in [4, 4]" will trigger this error.

To resolve this error, use the 'track by' syntax for ng-repeat.
e.g. ng-repeat="value in [4, 4] track by $index" will cause the items to be
keyed by their position in the array instead of their value.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice example! Lot's of people are likely to get caught out by this at some point.