diff --git a/src/app/directives/templateParamSelector.js b/src/app/directives/templateParamSelector.js index 8a09e814f28..d9ad33512b5 100644 --- a/src/app/directives/templateParamSelector.js +++ b/src/app/directives/templateParamSelector.js @@ -75,6 +75,11 @@ function (angular, app, _, $) { $button.focus(); }); + $scope.$on('$destroy', function() { + $button.unbind(); + typeahead.destroy(); + }); + $compile(elem.contents())($scope); } }; diff --git a/src/app/features/dashboard/dashboardCtrl.js b/src/app/features/dashboard/dashboardCtrl.js index c9a5f119e09..9c878a06bac 100644 --- a/src/app/features/dashboard/dashboardCtrl.js +++ b/src/app/features/dashboard/dashboardCtrl.js @@ -31,13 +31,6 @@ function (angular, $, config) { $scope.setupDashboard(dashboard); }; - $scope.registerWindowResizeEvent = function() { - angular.element(window).bind('resize', function() { - $timeout.cancel(resizeEventTimeout); - resizeEventTimeout = $timeout(function() { $scope.$broadcast('render'); }, 200); - }); - }; - $scope.setupDashboard = function(dashboard) { $rootScope.performance.dashboardLoadStart = new Date().getTime(); $rootScope.performance.panelsInitialized = 0; @@ -123,5 +116,15 @@ function (angular, $, config) { $rootScope.$broadcast('render'); }; + $scope.registerWindowResizeEvent = function() { + angular.element(window).bind('resize', function() { + $timeout.cancel(resizeEventTimeout); + resizeEventTimeout = $timeout(function() { $scope.$broadcast('render'); }, 200); + }); + $scope.$on('$destroy', function() { + angular.element(window).unbind('resize'); + }); + }; + }); }); diff --git a/src/vendor/bootstrap/bootstrap.js b/src/vendor/bootstrap/bootstrap.js index ba7dbadeb12..0a427f05858 100644 --- a/src/vendor/bootstrap/bootstrap.js +++ b/src/vendor/bootstrap/bootstrap.js @@ -1956,7 +1956,7 @@ return items ? this.process(items) : this } - , process: function (items) { + , process: function (items) { var that = this items = $.grep(items, function (item) { @@ -2050,6 +2050,11 @@ .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) .on('mouseleave', 'li', $.proxy(this.mouseleave, this)) + }, + + destroy: function () { + this.$element.off().removeData('typeahead'); + this.$menu.off(); } , eventSupported: function(eventName) { diff --git a/src/views/index.html b/src/views/index.html index c29fdd5a28a..a5b0dbba05c 100644 --- a/src/views/index.html +++ b/src/views/index.html @@ -22,7 +22,7 @@ - +