This.sendAction is not working for checkbox


#1

Any help on this is appreciated


#2
<input
  type="checkbox"
  checked={{something}}
  onchange={{action 'somethingChanged' value='target.value'}} />
somethingChanged(checked) {
  // do something
  this.set('something', checked);
}

#3

not really an answer to my question : ) i do know alternate ways of doing it.

Btw for those who want to know kindly do click that link. Its because Ember.Checkbox is a view before 2.0 version. It becomes a component only post 2.0

Solution: untill you upgrade to 2.0 use it as a view. Set an object which will be binded to controller property or best is take in controller context and do controller.send(). The latter is best Tried and tested


#4

The problem with your approach is if anything changes what you have bound to checked, then this action will fire despite the action not originating from the change event on the input. Because of that, it’s prone to odd side effects, potential performance issues, and typically a bad time when it comes to debugging.

You can get away with no longer using the input helper in 2.0.


#5

its a input view extended from checkbox so the only thing that can change is the checked value. And yes once we upgrade to 2.0 i will change this to component.