knownasilya / ember-toggle

Checkbox based Toggle Switches for Ember
http://knownasilya.github.io/ember-toggle/
MIT License
112 stars 52 forks source link

How to work with booleans? #55

Closed jurgenwerk closed 8 years ago

jurgenwerk commented 8 years ago

I'm having difficulties getting this to work with toggling booleans.

component:

...
booleanValue: false,
...

template:

my value: {{booleanValue}}
{{x-toggle value=booleanValue onToggle=(mut booleanValue) theme='light' size='large'}}

.. then the output is either my value: on or my value: off. Is it possible to simply toggle between true and false?

knownasilya commented 8 years ago

See the first example here https://github.com/knownasilya/ember-cli-toggle#labels

jurgenwerk commented 8 years ago

@knownasilya thank you, this works. In my opinion, this API is fairly unintuitive and unusual. To set possible toggle values in a string, and pass it in a property named onLabel/offLabel just seems kinda odd. I'm wondering what led you to this decision in the latest major release? On the other hand, thanks a lot for making and maintaining this add-on, I use it in a couple of projects.

knownasilya commented 8 years ago

Mainly it was from a contributors PR. I'm open for alternatives.