I've been really struggling with radio buttons. I just want to dynamically create some radio buttons and then bind the checked radio button to a property on the controller.
I tried the answer in this question: https://stackoverflow.com/a/18991426/62653
However, it doesn't work when you create the radio buttons dynamically.
This is a snippet from the accepted answer:
<label>
{{view Ember.RadioButton name="selectionTest" selectionBinding="isSelected" value="true"}}
true
</label>
<label>
{{view Ember.RadioButton name="selectionTest" selectionBinding="isSelected" value="false"}}
false
</label>
But when you create the radio button views dynamically like this, it doesn't work:
{{#each myModel.someCollection}}
<label>
{{view Ember.RadioButton name="selectionTest" selectionBinding="isSelected" value=id}}
{{id}}
</label>
{{/each}}
If you use a loop to create the radio buttons as above, the property isSelected
doesn't get updated.
Any ideas or other solutions to bind radio buttons?