1@Component({...})
2export class CounterComponent {
3
4 @Input()
5 count: number = 0;
6
7 @Output()
8 change: EventEmitter<number> = new EventEmitter<number>();
9
10 increment() {
11 this.count++;
12 this.change.emit(this.count);
13 }
14
15 decrement() {
16 this.count--;
17 this.change.emit(this.count);
18 }
19
20 // in parent component
21 //(change)="countChange($event)">
22
23}
24
1// just use it normal
2@Output() itch:EventEmitter<any> = new EventEmitter();
3
4//and call in html
5<div appCollar (itch)='scratch()' >