event emitter bind components angular 9 code example
Example 1: output events in angular with asynchronous
content_copy
<zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
Example 2: output event angular
@Component({...})
export class CounterComponent {
@Input()
count: number = 0;
@Output()
change: EventEmitter<number> = new EventEmitter<number>();
increment() {
this.count++;
this.change.emit(this.count);
}
decrement() {
this.count--;
this.change.emit(this.count);
}
// in parent component
//(change)="countChange($event)">
}