Closed mmaestri closed 10 years ago
Why would you want to "disable" the toggle without adding the disabled
class?
Because I needed two behaviours
Block edit, maintain value -> editable. I have a set of toggles which reflects some user config. It should not be editable unless the user presses some button.
Block edit, set value to false -> disabled. Same set of toggles, some are enabled or disabled according to other toggle values. Here I needed somehow to show the user that the control is actually disabled. Hence, I added the disabled class.
Sounds like you would just be better served by adding a separate class on the toggle that doesn't "grey out" the toggle.
<toggle-switch class="no-disable"></toggle-switch>
@mmaestri If you remove editable
, change enable
to disable
, and use the attr.$observe
, I'll merge this in today. We can work out the editable
feature in another pull request.
Done. I'm on the office right now and don't have much more time, but I've made a few tests and it seems to work well. Sorry about indentation...I'm used to tabs, if there's a problem with that I'll change to whatever you like.
Thanks
AngularJS uses 2 spaces tabs. So i'm just following suit.
@cgarvis Done. Let me know if there's something else to do.
Thanks
@mmaestri tab indent is back
Hi I've stumbled upon this and it was exactly what I was looking for. I made a few changes that you might like to check. It just adds two attributes: enabled and editable.
enabled: allows to disable the toggle and adds a 'disabled' class to reflect its status. editable: it only disables the toggle.
Sorry if I'm missing some 'github etiquette', I'm new to this.
Thanks for your work
mgmaestri