Skip to content

Instantly share code, notes, and snippets.

@Pablo-Merino
Last active August 29, 2015 14:25
Show Gist options
  • Save Pablo-Merino/ed51d54550d5fe127e7b to your computer and use it in GitHub Desktop.
Save Pablo-Merino/ed51d54550d5fe127e7b to your computer and use it in GitHub Desktop.
Ember Radio Button implementation with checked value and action
import Ember from 'ember';
export default Ember.Component.extend({
/**
* Specifies the HTML tag the component will render
*
* @property tagName
* @type string
*/
tagName: "input",
/**
* Specifies what type of input it'll be
*
* @property type
* @type string
*/
type: "radio",
/**
* Attributes allowed for the component
*
* @property attributeBindings
* @type array
*/
attributeBindings: [
"name",
"type",
"value",
"checked:checked",
"changedAction"
],
/**
* Method that handles a click in a radio button. It bubbles up to the
* action specified in `changedAction`. Usually in a controller.
*
* @method click
*/
click: function() {
this.sendAction('changedAction', this.get('value'));
this.set("selection", this.$().val());
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment