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

Watch focusser to disable ui-select #445

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,8 @@
$select.ngModel = ngModel;

//Idea from: https://github.com/ivaynberg/select2/blob/79b5bf6db918d7560bdd959109b7bcfb47edaf43/select2.js#L1954
var focusser = angular.element("<input ng-disabled='$select.disabled' class='ui-select-focusser ui-select-offscreen' type='text' aria-haspopup='true' role='button' />");
//Don't disable this field, since it's css selector (:disabled) is being monitored to identify if it's in a fieldset.
var focusser = angular.element("<input class='ui-select-focusser ui-select-offscreen' type='text' aria-haspopup='true' role='button' />");

if(attrs.tabindex){
//tabindex might be an expression, wait until it contains the actual value before we set the focusser tabindex
Expand Down Expand Up @@ -988,7 +989,13 @@

attrs.$observe('disabled', function() {
// No need to use $eval() (thanks to ng-disabled) since we already get a boolean instead of a string
$select.disabled = attrs.disabled !== undefined ? attrs.disabled : false;
$select.disabledFlag = attrs.disabled !== undefined ? attrs.disabled : false;
$select.disabled = $select.disabledFlag || $select.disabledSelector;
});

scope.$watch(function () { return focusser.is(":disabled"); }, function (value) {
$select.disabledSelector = value;
$select.disabled = $select.disabledFlag || $select.disabledSelector;
});

attrs.$observe('resetSearchInput', function() {
Expand Down