Skip to content

Commit

Permalink
Merge pull request #185 from Availity/fix/dropdownResize
Browse files Browse the repository at this point in the history
adding check for closeOnResize option
  • Loading branch information
robmcguinness committed Jan 23, 2016
2 parents 2bf7eb0 + 5d2d82f commit fe6899e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/ui/dropdown/dropdown.js
Expand Up @@ -5,6 +5,7 @@
var availity = root.availity;

availity.ui.provider('avDropdownConfig', function() {

var config = {
closeOnResize: true,
dropdownAutoWidth: true,
Expand Down Expand Up @@ -354,6 +355,7 @@
require: ['ngModel', 'avDropdown'],
controller: 'AvDropdownController',
link: function(scope, element, attrs, controllers) {

var ngModel = controllers[0];
var avDropdown = controllers[1];

Expand Down Expand Up @@ -428,7 +430,6 @@
}
});


var _$render = ngModel.$render;
ngModel.$render = function() {
_$render();
Expand All @@ -441,11 +442,14 @@

};

var win = angular.element($window);
if(avDropdown.options.closeOnResize) {

win.bind('resize', function() {
element.select2('close');
});
var win = angular.element($window);
win.bind('resize', function() {
element.select2('close');
});

}

attrs.$observe('disabled', function (value) {
element.select2('enable', !value);
Expand Down

0 comments on commit fe6899e

Please sign in to comment.