cgarvis / angular-toggle-switch

AngularJS Toggle Switch
http://cgarvis.github.io/angular-toggle-switch
MIT License
160 stars 124 forks source link

"disabled" as boolean attribute #52

Closed leesei closed 9 years ago

leesei commented 10 years ago

In HTML5, "disabled" as boolean attribute. A input is disabled as long as "disabled" is defined in the attribute, regardless of its value. http://www.w3.org/TR/html5/infrastructure.html#boolean-attribute

Can this logic handle the case

<toggle-switch ng-model="switchStatus" disabled><toggle-switch>
        attrs.$observe('disabled', function(disabled) {
          if(disabled === 'true') {
            isEnabled = false;
          } else {
            isEnabled = true;
          }
        });
sgentile commented 9 years ago

I'm requiring the same where I bind to a boolean

sgentile commented 9 years ago

I fixed the issue with disabling in a fork: https://github.com/SMARTDATASYSTEMSLLC/angular-toggle-switch

cgarvis commented 9 years ago

In the latest release, this is how it works.