From 91bf06f289632f331fd125851282cb9f5b499bd4 Mon Sep 17 00:00:00 2001 From: c0bra Date: Wed, 12 Nov 2014 11:25:01 -0600 Subject: [PATCH] fix(uiGridMenu): Only run applyHide when not shown applyHide() was running on all GRID_SCROLL events, whether or not the menu was visible. This was causing excess $digest() loops. --- src/js/core/directives/ui-grid-menu.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/core/directives/ui-grid-menu.js b/src/js/core/directives/ui-grid-menu.js index d1858a9142..329ead7f8d 100644 --- a/src/js/core/directives/ui-grid-menu.js +++ b/src/js/core/directives/ui-grid-menu.js @@ -123,9 +123,11 @@ function ($compile, $timeout, $window, $document, gridUtil, uiGridConstants) { // *** Auto hide when click elsewhere ****** var applyHideMenu = function(){ - $scope.$apply(function () { - $scope.hideMenu(); - }); + if ($scope.shown) { + $scope.$apply(function () { + $scope.hideMenu(); + }); + } }; if (typeof($scope.autoHide) === 'undefined' || $scope.autoHide === undefined) {