Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
chore(dropdown): avoid toggling class on first load
Browse files Browse the repository at this point in the history
- Avoid toggling class on first load of directive

Closes #5341
  • Loading branch information
jburson authored and wesleycho committed Feb 5, 2016
1 parent ca6b177 commit 9c0acf6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,15 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
}

var openContainer = appendTo ? appendTo : $element;
var hasOpenClass = openContainer.hasClass(appendTo ? appendToOpenClass : openClass);

$animate[isOpen ? 'addClass' : 'removeClass'](openContainer, appendTo ? appendToOpenClass : openClass).then(function() {
if (angular.isDefined(isOpen) && isOpen !== wasOpen) {
toggleInvoker($scope, { open: !!isOpen });
}
});
if (hasOpenClass === !isOpen) {
$animate[isOpen ? 'addClass' : 'removeClass'](openContainer, appendTo ? appendToOpenClass : openClass).then(function() {
if (angular.isDefined(isOpen) && isOpen !== wasOpen) {
toggleInvoker($scope, { open: !!isOpen });
}
});
}

if (isOpen) {
if (self.dropdownMenuTemplateUrl) {
Expand Down

0 comments on commit 9c0acf6

Please sign in to comment.