fix(scroll): cleanup native scroll listeners only if activated

This commit is contained in:
perry
2015-02-13 11:51:06 -06:00
parent be09433608
commit df6dcb96f6
2 changed files with 17 additions and 5 deletions

View File

@@ -246,14 +246,14 @@ IonicModule
ionic.on('touchmove', handleTouchmove, scrollChild);
ionic.on('touchend', handleTouchend, scrollChild);
ionic.on('scroll', handleScroll, scrollParent);
// cleanup when done
$scope.$on('$destroy', destroy);
};
$scope.$on('$destroy', destroy);
function destroy() {
ionic.off('dragdown', handleTouchmove, scrollChild);
ionic.off('dragend', handleTouchend, scrollChild);
ionic.off('touchmove', handleTouchmove, scrollChild);
ionic.off('touchend', handleTouchend, scrollChild);
ionic.off('scroll', handleScroll, scrollParent);
scrollParent = null;
scrollChild = null;