lordfriend / nya-bootstrap-select

An AngularJS select replacement which build select like dropdown component with collection and ng-model support
http://nya.io/nya-bootstrap-select/
MIT License
179 stars 81 forks source link

Disabling dropdown is not working #113

Closed arteme closed 8 years ago

arteme commented 8 years ago

With Angular 1.4.8 (or 1.2.1) and nya-bootstrap-select 2.1.2 disbling the select control using "disable" attribute disables the coltrol, but still allows the user to open the option list.

Given the following HTML:

    <ol 
      class="nya-bs-select" 
      ng-model="select"
      disabled="disable"
    >
      <li nya-bs-option="option in options">
        <a>
          {{ option }}
          <span class="glyphicon glyphicon-ok check-mark"></span>
        </a>
      </li>
    </ol>

And the following javascript:

    $scope.select;
    $scope.options = ['One', 'Two', 'Three'];
    $scope.disable = true;

The select control shows as disabled, but if you click on it, the options list still opens.

See this fiddle: https://jsfiddle.net/qt3p5e7n/2/

arteme commented 8 years ago

The directive generates a button element, which gets class="disabled" attribute set when the disable expression evaluated to true, but the button doesn't get disabled="disabled" attribute. If that is added, it would work correctly.