Ng-repeat Showing Irregular Behavior With One Time Binding
Solution 1:
From the Docs:
Avoid using
track by $indexwhen the repeated template contains one-time bindings. In such cases, thenthDOM element will always be matched with thenthitem of the array, so the bindings on that element will not be updated even when the corresponding item changes, essentially causing the view to get out-of-sync with the underlying data.— AngularJS ng-repeat API Reference
If you are working with objects that have a unique identifier property, you should track by this identifier instead of the object instance. Should you reload your data later, ngRepeat will not have to rebuild the DOM elements for items it has already rendered, even if the JavaScript objects in the collection have been substituted for new ones. For large collections, this significantly improves rendering performance.
Post a Comment for "Ng-repeat Showing Irregular Behavior With One Time Binding"