From a07ee67eb941c80e721b5794cb6dad1bd90d5358 Mon Sep 17 00:00:00 2001 From: Haokun-Chen Date: Thu, 28 Jun 2018 11:01:01 -0400 Subject: [PATCH] deregister the transition hook when destroy smart-search controller --- .../src/shared/smart-search/smart-search.controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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');