Flicker and duplicate items in list on polling refresh

I’m using angular-poller to get data from my api server every 5 seconds. I’m getting the data from the promise it returns and assigning it to the scope within the ‘.then’ method. It works, but everytime it updates it duplicates all items on the list for a split second while it’s updating and then they go away. Any idea on why this is happening?

The photo should have only 2 items in the list, but when it refreshes, they’re duplicated for a split second and it flickers.

Are you using “track by”? That solved my troubles with this a while back.

http://docs.angularjs.org/api/ng/directive/ngRepeat

2 Likes
With the release of AngularJS 1.2 earlier this week, I have to say that the feature about which I am most excited is the "track by" augmentation for ngRepeat. This feature allows you to associate a JavaScript object with an ngRepeat DOM (Document Object Model) node using a unique identifier. With this association in place, AngularJS will not $destroy and re-create DOM nodes unnecessarily. This can have a huge performance and user experience benefit.

That’s exactly what I needed! Thank you!!!