Want to create a component that generates Radio-buttons in EmberJS? Yeah, You can pass anything to components. Just a try to the radio-buttons.
1 2 3 4 5 6 7 8 9 10 11 12 13 | //Basic radio Component App.RadioButton = Ember.Component.extend({ tagName : "input", type : "radio", attributeBindings : [ "name", "type", "value", "checked:checked" ], click : function() { this.set("selection", this.$().val()); }, checked : function() { return this.get("value") === this.get("selection"); }.property('selection') }); Em.Handlebars.helper('radio-button',App.RadioButton); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.