From 5e8250b119063a9ba533db62a3aad317afaf75a5 Mon Sep 17 00:00:00 2001 From: Perry Govier Date: Fri, 12 Sep 2014 11:14:39 -0500 Subject: [PATCH] fix(scrollView): check that element has not yet been GC'd before removing event listeners in $destroy --- js/angular/directive/infiniteScroll.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/angular/directive/infiniteScroll.js b/js/angular/directive/infiniteScroll.js index 41c9dbd0832..f6896d97ecb 100644 --- a/js/angular/directive/infiniteScroll.js +++ b/js/angular/directive/infiniteScroll.js @@ -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);