简体   繁体   中英

Radio button with action not working on Ember.js

I got a table with different radio buttons in each line, when I assign an action to the radio button and click it, the changed attribute is not set to true, and the radio button stays empty, even though the action was executed.

Example:

<input type="radio" name="x" value="value" {{action 'helloWorld'}}>    

Radios aren't part of core Ember. Try using a library like ember-radio-button . It gives you a changed property which you can use to send out an action.

I had the same problem. Instead of putting a direct action on the input, set it to the input's onchange like this.

<input type="radio" name="x" value="value"
       onchange={{action 'helloWorld' value="target.value"}}> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM