ngRepeat:dupes error when iterating over duplicate keys in AngularJS
0 reputation · 22 Apr 2026, 09:55 UTC
Problem: ngRepeat:dupes error when rendering duplicate items
AngularJS 1.x throws the ngRepeat:dupes error when an ng-repeat directive encounters two or more items that produce the same tracking value. By default, the tracking value is the item itself, so primitive duplicates or identical objects trigger the error.
To avoid the error, a track by expression must be supplied so that AngularJS can generate a unique key for each DOM element. Common solutions include track by $index or using a stable identifier such as track by item.id. However, using $index can lead to subtle bugs when the collection is reordered, while a unique property offers predictable rendering.
In development mode the console displays the error, but it is suppressed in production builds.
- What is the minimal
track byexpression that reliably eliminates the ngRepeat:dupes error for collections containing duplicate values? - Under what circumstances does using
$indexas the tracking key introduce rendering inconsistencies, and how can these be mitigated? - How does the suppression of ngRepeat:dupes warnings in production affect debugging and performance profiling?