such as < md-slide-toggle (change) = "onChange ($event.checked)" > switch < / md-slide-toggle >
, event binding. $event is a DOM Event object,
where $event.checked
how does the boolean value be generated?
Template fragment:
<md-slide-toggle (change)="onChange($event.checked)"></md-slide-toggle>
TS fragment:
@Output() toggleDarkTheme = new EventEmitter<boolean>();
onChange(checked: boolean) {
this.toggleDarkTheme.emit(checked);
}
Oh, I can"t believe I didn"t answer. Did I not make myself clear?