mardi 5 mai 2015

How to get checkbox state in Ember.js?

I have created a component which renders checkboxes with values correctly set. They can also respond to click events, so in the hbs template there's a loop which renders the checkboxes like that:

<input class="conditions" type="checkbox" value="{{c.id}}" 
  {{action "conditionChecked" r preventDefault=false}} 
  checked={{c.checked}} />{{c.name}}

In the component I have the actions: that contains the conditionChecked hook. The hook has c parameter which is what I'm passing from the template which also has the checked attribute that's always equals to true.

How can I access the actual state of the checkbox based on user's selection (checked/unchecked)?




Aucun commentaire:

Enregistrer un commentaire