lumapps / lumX

The first responsive front-end framework based on Angular & Google Material Design specifications
https://ui.lumapps.com
MIT License
1.96k stars 273 forks source link

Update data-table.html #551

Closed andersonmarin closed 7 years ago

andersonmarin commented 7 years ago

Fix ngRepeat:dupes Duplicate Key in Repeater

clementprevot commented 7 years ago

Hi @andersonmarin and thank you for your contribution.

However we will not merge this one into LumX. Most of the time, its a pretty bad practice to track by $index. Because what Angular does in this case is "watching" for a change in the index of the element to determine if he need to recompile it. This means that, for example, if you delete an element in the middle of your array, it will be the last one of the list that will be deleted in your template. This can also leads to some problems with pagination and more generally with change detection.

To avoid having duplicate repeaters in your case, I recommend deduplicating your list before passing it to LumX