fix(scrollView): check that element has not yet been GC'd before removing event listeners in $destroy

This commit is contained in:
Perry Govier
2014-09-12 11:14:39 -05:00
parent ed3e9e30ce
commit 5e8250b119

View File

@@ -119,7 +119,8 @@ IonicModule
});
$scope.$on('$destroy', function() {
scrollCtrl.$element.off('scroll', checkBounds);
console.log(scrollCtrl);
if(scrollCtrl && scrollCtrl.$element)scrollCtrl.$element.off('scroll', checkBounds);
});
var checkBounds = ionic.animationFrameThrottle(checkInfiniteBounds);