fix(toggle): use renderer for checked

This commit is contained in:
Adam Bradley
2016-01-06 15:04:05 -06:00
parent 15bbe75649
commit 9d5cffb900
2 changed files with 44 additions and 75 deletions

View File

@ -32,7 +32,7 @@ import {Form} from '../../util/form';
],
host: {
'role': 'checkbox',
'tappable': 'true',
'tappable': '',
'class': 'item',
'tabindex': 0,
'[attr.aria-disabled]': 'disabled'
@ -60,7 +60,6 @@ export class Checkbox {
this.onChange = (_) => {};
this.onTouched = (_) => {};
this.ngControl = ngControl;
if (ngControl) {
ngControl.valueAccessor = this;
}
@ -85,7 +84,6 @@ export class Checkbox {
*/
toggle() {
this.checked = !this.checked;
this.onChange(this.checked);
}
get checked() {
@ -93,8 +91,9 @@ export class Checkbox {
}
set checked(val) {
this._checked = val;
this._renderer.setElementAttribute(this._elementRef, 'aria-checked', !!val);
this._checked = !!val;
this._renderer.setElementAttribute(this._elementRef, 'aria-checked', this._checked);
this.onChange(this._checked);
}
/**