Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 95692e7

Browse files
committed
fix: properly gc on destruction
- Properly garbage collect resize handler when directive is destroyed - Properly debounce callback
1 parent a4a010d commit 95692e7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/uiSelectController.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -631,12 +631,14 @@ uis.controller('uiSelectCtrl',
631631
}
632632
}
633633

634+
var onResize = $$uisDebounce(function() {
635+
ctrl.sizeSearchInput();
636+
}, 50);
637+
638+
angular.element($window).bind('resize', onResize);
639+
634640
$scope.$on('$destroy', function() {
635641
ctrl.searchInput.off('keyup keydown tagged blur paste');
642+
angular.element($window).off('resize', onResize);
636643
});
637-
638-
angular.element($window).bind('resize', $$uisDebounce(function() {
639-
ctrl.sizeSearchInput();
640-
}), 50);
641-
642644
}]);

0 commit comments

Comments
 (0)