From 0170128d6abb193db01f37962d9aa51c2e39bad1 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Mon, 7 Sep 2020 07:45:14 -0400 Subject: make sure pullup directive cleans up resize listern --- etc/js/ion-pullup.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/js/ion-pullup.js b/etc/js/ion-pullup.js index 9c0b2470..723456f2 100644 --- a/etc/js/ion-pullup.js +++ b/etc/js/ion-pullup.js @@ -212,7 +212,12 @@ angular.module('ionic-pullup', []) } }; + function cleanup() { + $window.removeEventListener('orientationchange', updateUI); + deregisterWatch(); + } var deregisterWatch = $scope.$watch('state', function (newState, oldState) { + if (oldState === undefined || newState == oldState) return; switch (newState) { case FooterState.COLLAPSED: @@ -228,7 +233,7 @@ angular.module('ionic-pullup', []) $rootScope.$broadcast('ionPullUp:tap', $scope.state, footer.defaultBehavior); }); - $scope.$on('$destroy', deregisterWatch); + $scope.$on('$destroy', cleanup); $ionicPlatform.ready(function () { $window.addEventListener('orientationchange', updateUI); -- cgit v1.2.3