diff --git a/src/dropdown/dropdown.js b/src/dropdown/dropdown.js index f1c138a670..62c4582d6f 100644 --- a/src/dropdown/dropdown.js +++ b/src/dropdown/dropdown.js @@ -78,7 +78,7 @@ angular.module('ui.bootstrap.dropdown', []) } }; - scope.$watch('isOpen', function( isOpen ) { + scope.$watch('isOpen', function( isOpen, wasOpen ) { $animate[isOpen ? 'addClass' : 'removeClass'](self.$element, openClass); if ( isOpen ) { @@ -89,7 +89,9 @@ angular.module('ui.bootstrap.dropdown', []) } setIsOpen($scope, isOpen); - toggleInvoker($scope, { open: !!isOpen }); + if (angular.isDefined(wasOpen) && isOpen !== wasOpen) { + toggleInvoker($scope, { open: !!isOpen }); + } }); $scope.$on('$locationChangeSuccess', function() { diff --git a/src/dropdown/test/dropdown.spec.js b/src/dropdown/test/dropdown.spec.js index 77c7f509b9..d0bf45a2bd 100644 --- a/src/dropdown/test/dropdown.spec.js +++ b/src/dropdown/test/dropdown.spec.js @@ -212,16 +212,18 @@ describe('dropdownToggle', function() { describe('`on-toggle`', function() { beforeEach(function() { $rootScope.toggleHandler = jasmine.createSpy('toggleHandler'); - element = $compile('