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({
tagName: 'label',
didInsertElement() {
this._super();
@on("didInsertElement")
_init() {
const checked = this.get('checked');
if (checked && checked !== "false") {
this.$('input').prop('checked', true);
@ -18,8 +17,7 @@ export default Ember.Component.extend({
},
@on('willDestroyElement')
willDestroyElement() {
this._super();
_clear() {
this.$('input').off('click.d-checkbox');
}
});

View File

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