Add support for disabled attribute to the d-checkbox component

This commit is contained in:
Régis Hanol 2017-08-07 18:16:43 +02:00
parent 1103ea7c4c
commit 770efee25f
2 changed files with 4 additions and 6 deletions

View File

@ -3,9 +3,8 @@ import { on } from "ember-addons/ember-computed-decorators";
export default Ember.Component.extend({ export default Ember.Component.extend({
tagName: 'label', tagName: 'label',
didInsertElement() { @on("didInsertElement")
this._super(); _init() {
const checked = this.get('checked'); const checked = this.get('checked');
if (checked && checked !== "false") { if (checked && checked !== "false") {
this.$('input').prop('checked', true); this.$('input').prop('checked', true);
@ -18,8 +17,7 @@ export default Ember.Component.extend({
}, },
@on('willDestroyElement') @on('willDestroyElement')
willDestroyElement() { _clear() {
this._super();
this.$('input').off('click.d-checkbox'); this.$('input').off('click.d-checkbox');
} }
}); });

View File

@ -1,2 +1,2 @@
<input type='checkbox'> <input type='checkbox' disabled={{disabled}}>
{{i18n label}} {{i18n label}}