How do I create a component that generates Radio-buttons in Ember.js?

ember.js, handlebars.js

Solution

Yeah, You can pass anything to components. Just a try to the radio-buttons

//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);

Updated (component name should be dasherized)

Working Radio Demo

Problem

Can I and should i pass arrays to components in ember? For example if I wanted to template something that renders a couple of radiobuttons with labels: ``` <label for="media">Media</label><input type="radio" name="entry.1602323871" value="media" id="media" /> <label for="guest">Guest</label><input type="radio" name="entry.1602323871" value="guest" id="guest" /> ``` Could I somehow pass an array with this content and loop through it. ``` Media, media Guest, guest ```

Original source