no input element in checkbox

This commit is contained in:
Adam Bradley
2015-08-06 12:46:45 -05:00
parent 9968b483a6
commit 563dd8d521

View File

@ -23,8 +23,9 @@ import {TapClick} from '../button/button';
host: { host: {
'class': 'item', 'class': 'item',
'role': 'checkbox', 'role': 'checkbox',
'[attr.aria-checked]': 'input.checked', '[attr.tab-index]': 'tabIndex',
'[attr.aria-disabled]': 'input.disabled', '[attr.aria-checked]': 'checked',
'[attr.aria-disabled]': 'disabled',
'[attr.aria-labelledby]': 'labelId', '[attr.aria-labelledby]': 'labelId',
'(^click)': 'click($event)' '(^click)': 'click($event)'
}, },
@ -33,7 +34,6 @@ import {TapClick} from '../button/button';
@IonicView({ @IonicView({
template: template:
'<div class="item-media media-checkbox">' + '<div class="item-media media-checkbox">' +
'<input type="checkbox" aria-hidden="true">' +
'<div class="checkbox-icon"></div>' + '<div class="checkbox-icon"></div>' +
'</div>' + '</div>' +
'<div class="item-content" id="{{labelId}}">' + '<div class="item-content" id="{{labelId}}">' +
@ -49,6 +49,7 @@ export class Checkbox extends IonInputItem {
) { ) {
super(elementRef, config); super(elementRef, config);
this.tapClick = tapClick; this.tapClick = tapClick;
this.tabIndex = 0;
this.onChange = (_) => {}; this.onChange = (_) => {};
this.onTouched = (_) => {}; this.onTouched = (_) => {};
@ -63,14 +64,8 @@ export class Checkbox extends IonInputItem {
this.labelId = 'label-' + this.id; this.labelId = 'label-' + this.id;
} }
onAllChangesDone() {
this.input.checked = this.checked;
this.input.disabled = this.disabled;
this.input.value = this.value;
}
toggle() { toggle() {
this.input.checked = this.checked = !this.input.checked; this.checked = !this.checked;
this.onChange(this.checked); this.onChange(this.checked);
} }
@ -82,9 +77,8 @@ export class Checkbox extends IonInputItem {
} }
} }
// Called by the model (Control) to update the view
writeValue(modelValue) { writeValue(modelValue) {
this.input.checked = modelValue; this.checked = modelValue;
} }
// Used by the view to update the model (Control) // Used by the view to update the model (Control)