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

View File

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