virtualRepeat directive cleanup

This commit is contained in:
Ulrich Sossou
2013-11-23 20:04:36 +01:00
parent 510c2db303
commit 1f52d9de18
2 changed files with 8 additions and 0 deletions

View File

@@ -313,6 +313,10 @@ angular.module('ionic.ui.virtualRepeat', [])
// When the user scrolls, we move the `state.firstActive`
dom.bind('momentumScrolled', sfVirtualRepeatOnScroll);
scope.$on('$destroy', function () {
dom.unbind('momentumScrolled', sfVirtualRepeatOnScroll);
});
// The watch on the collection is just a watch on the length of the
// collection. We don't care if the content changes.
scope.$watch(sfVirtualRepeatWatchExpression, sfVirtualRepeatListener, true);