FAQ Database Discussion Community


ng-repeat track by is not working: slow and still generating $$hashKey

javascript,angularjs,angularjs-ng-repeat,angularjs-track-by
I have an ng-repeat set up like so: ng-repeat="article in main[main.mode].primary | orderBy: main[main.mode].primary.filter.order track by article.url" main[main.mode].primary is an array and ….filter.order is a string. According to this blog post Behind the scenes ngRepeat adds a $$hashKey property to each task to keep track of it. If you replace...

ngRepeat track by: How to add event hook on model change?

javascript,angularjs,angularjs-ng-repeat,ng-repeat,angularjs-track-by
I have a simple ngRepeat like the following: <some-element ng-repeat="singleRecord in arrayOfRecords track by singleRecord.id"> <!-- stuff --> </some-element> arrayOfRecords is updated from a server and may contain new data. ngRepeat's track by feature can figure out when a new element is added to the array and automatically updates the...

Angular duplicates track by

javascript,angularjs,angularjs-track-by
I have this plunk: http://plnkr.co/edit/7X8VMG?p=preview and when I filter by clicking "Uncompleted" I'm getting the duplicates error in repeater Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: node in nodes track by node.id, Duplicate key: 1441, Duplicate value: {"name":"1","id":1441,"created_at":... But if you...

Angular: What do you do when you need to 'track by' but you don't have a unique property to track by?

javascript,angularjs,angularjs-ng-repeat,angularjs-track-by
Say that I'm ng-repeating over images, which is an array of objects that have a src and a caption property. var images = [ {src: 'a.jpg', caption: 'a'}, {src: 'b.jpg', caption: 'b'}, {src: 'c.jpg', caption: 'c'}, {src: 'd.jpg', caption: 'd'}, {src: 'e.jpg', caption: 'e'}, {src: 'f.jpg', caption: 'f'}, {src: 'g.jpg',...