Closed mariusbrn closed 9 years ago
Why in your directive the attribute disabled is defined as a string? disabled="false" will disable the switch anyway. It's possible to achieve it with something like this:
disabled
disabled="false"
<toggle-switch disabled="{{ (isAdmin) ? '' : 'true' }}" ng-model="lock"></toggle-switch>
But your example with true leaves me thinking that the opposite is possible.
true
Maybe the local scope property should be = instead of @.
=
@
scope: { disabled: '=', ... },
This will give the possibility to disable the switch with a scope variable.
<toggle-switch disabled="true" ng-model="lock"></toggle-switch> <toggle-switch disabled="false" ng-model="lock"></toggle-switch> <toggle-switch disabled="!isAdmin" ng-model="lock"></toggle-switch>
Why in your directive the attribute
disabled
is defined as a string?disabled="false"
will disable the switch anyway. It's possible to achieve it with something like this:But your example with
true
leaves me thinking that the opposite is possible.Maybe the local scope property should be
=
instead of@
.This will give the possibility to disable the switch with a scope variable.