diff --git a/awx/ui/client/src/shared/smart-search/smart-search.controller.js b/awx/ui/client/src/shared/smart-search/smart-search.controller.js index 16ec69e804..8c2523c81d 100644 --- a/awx/ui/client/src/shared/smart-search/smart-search.controller.js +++ b/awx/ui/client/src/shared/smart-search/smart-search.controller.js @@ -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');