Skip to content

Commit

Permalink
Return during autobind if new/old items are the same
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Aug 23, 2014
1 parent d76edc6 commit 1fe9f16
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/ngMeteor-collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ ngMeteorCollections.factory('$collection', ['$q', 'HashKeyCopier',

if (auto) { // Deep watches the model and performs autobind.
scope.$watch(model, function (newItems, oldItems) {
if (angular.equals(newItems, oldItems)) {
return;
}

// Remove items that don't exist in the collection anymore.
angular.forEach(oldItems, function (oldItem) {
var index = newItems.map(function (item) {
Expand Down

0 comments on commit 1fe9f16

Please sign in to comment.