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

Commit

Permalink
fix($window): change input size on window resize
Browse files Browse the repository at this point in the history
Closes #522
  • Loading branch information
Jordan Lewis committed Feb 23, 2016
1 parent 3b1496c commit ce24981
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/select.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* ui-select
* http://github.com/angular-ui/ui-select
* Version: 0.14.8 - 2016-02-18T22:01:43.880Z
* Version: 0.14.9 - 2016-02-23T21:26:43.799Z
* License: MIT
*/

Expand Down
10 changes: 7 additions & 3 deletions dist/select.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* ui-select
* http://github.com/angular-ui/ui-select
* Version: 0.14.8 - 2016-02-18T22:01:43.792Z
* Version: 0.14.9 - 2016-02-23T21:26:43.724Z
* License: MIT
*/

Expand Down Expand Up @@ -264,8 +264,8 @@ uis.directive('uiSelectChoices',
* put as much logic in the controller (instead of the link functions) as possible so it can be easily tested.
*/
uis.controller('uiSelectCtrl',
['$scope', '$element', '$timeout', '$filter', 'uisRepeatParser', 'uiSelectMinErr', 'uiSelectConfig', '$parse', '$injector',
function($scope, $element, $timeout, $filter, RepeatParser, uiSelectMinErr, uiSelectConfig, $parse, $injector) {
['$scope', '$element', '$timeout', '$filter', 'uisRepeatParser', 'uiSelectMinErr', 'uiSelectConfig', '$parse', '$injector', '$window',
function($scope, $element, $timeout, $filter, RepeatParser, uiSelectMinErr, uiSelectConfig, $parse, $injector, $window) {

var ctrl = this;

Expand Down Expand Up @@ -875,6 +875,10 @@ uis.controller('uiSelectCtrl',
ctrl.searchInput.off('keyup keydown tagged blur paste');
});

angular.element($window).bind('resize', function() {
ctrl.sizeSearchInput();
});

}]);

uis.directive('uiSelect',
Expand Down
2 changes: 1 addition & 1 deletion dist/select.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/select.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/uiSelectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* put as much logic in the controller (instead of the link functions) as possible so it can be easily tested.
*/
uis.controller('uiSelectCtrl',
['$scope', '$element', '$timeout', '$filter', 'uisRepeatParser', 'uiSelectMinErr', 'uiSelectConfig', '$parse', '$injector',
function($scope, $element, $timeout, $filter, RepeatParser, uiSelectMinErr, uiSelectConfig, $parse, $injector) {
['$scope', '$element', '$timeout', '$filter', 'uisRepeatParser', 'uiSelectMinErr', 'uiSelectConfig', '$parse', '$injector', '$window',
function($scope, $element, $timeout, $filter, RepeatParser, uiSelectMinErr, uiSelectConfig, $parse, $injector, $window) {

var ctrl = this;

Expand Down Expand Up @@ -616,4 +616,8 @@ uis.controller('uiSelectCtrl',
ctrl.searchInput.off('keyup keydown tagged blur paste');
});

angular.element($window).bind('resize', function() {
ctrl.sizeSearchInput();
});

}]);

3 comments on commit ce24981

@coryvb123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hitting an issue where I'm dynamically changing the class on a parent element, changing it's width. For example, it's parent is going from col-md-12 to col-md-6. This results it the ui-select input being too wide. Is there a way I can call sizeSearchInput from my code?

@user378230
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coryvb123 see: Accessing $select

An example of something I did for a totally different request: #1544 (comment)

Should help, or you could try triggering resize event.

@coryvb123
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triggering the resize event worked great, thanks @user378230

Please sign in to comment.