s-yadav / angulargrid

Pinterest like responsive masonry grid system for angular
MIT License
277 stars 105 forks source link

Loading the same content twice hides all items #84

Closed nkovacic closed 8 years ago

nkovacic commented 8 years ago

If the same items are loaded twice using $http or $timout service, the grid doesnt calculate new positions and hidest the whole grid.

Example: http://codepen.io/nkovacic/pen/dpvLax The example uses 0.5 but the same error is still present in 0.6

s-yadav commented 8 years ago

If you are loading same objects again use track by $index (or track by with any other parameter, ie : track by card.id) in your ng-repeat. Because angular does not call deep watchers scope.$watch('model', watch, true); if same objects are assigned again (as it converts new object to JSON string and compares with the last JSON string, which would be the same). That's the reason angulargrid is not notified to reflow the grid.

nkovacic commented 8 years ago

Thank you for reminding me about the track by $index. It fixed this problem.