deregister the transition hook when destroy smart-search controller

This commit is contained in:
Haokun-Chen 2018-06-28 11:01:01 -04:00
parent e8748fa147
commit a07ee67eb9
No known key found for this signature in database
GPG Key ID: B2AA94BEF6591515

View File

@ -152,8 +152,11 @@ function SmartSearchController (
$scope.$emit(optionsKey, data.options);
}
});
$scope.$on('$destroy', transitionSuccessListener);
$scope.$on('$destroy', () => {
if (transitionSuccessListener) {
transitionSuccessListener();
}
});
$scope.$watch('disableSearch', disableSearch => {
if (disableSearch) {
$scope.searchPlaceholder = i18n._('Cannot search running job');