Skip to content

Commit

Permalink
fix(scrollView): check that element has not yet been GC'd before remo…
Browse files Browse the repository at this point in the history
…ving event listeners in $destroy
  • Loading branch information
perrygovier committed Sep 12, 2014
1 parent ed3e9e3 commit 5e8250b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/angular/directive/infiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5e8250b

Please sign in to comment.