REFACTOR: Allow `radio-button` component to be disabled.

This commit is contained in:
Guo Xiang Tan 2017-03-28 16:45:30 +08:00
parent 8bf12502bd
commit 874d151c05
1 changed files with 9 additions and 4 deletions

View File

@ -1,11 +1,16 @@
import computed from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({
tagName : "input",
type : "radio",
attributeBindings : [ "name", "type", "value", "checked:checked" ],
attributeBindings : ["name", "type", "value", "checked:checked", "disabled:disabled"],
click : function() {
this.set("selection", this.$().val());
},
checked : function() {
return this.get("value") === this.get("selection");
}.property('selection'),
@computed('value', 'selection')
checked(value, selection) {
return value === selection;
},
});