1 @Output() open: EventEmitter<any> = new EventEmitter();
2
3
4 toggel() {
5 this.open.emit(null);
6 }
1@Component({
2 selector : 'child',
3 template : `
4 <button (click)="sendNotification()">Notify my parent!</button>
5 `
6})
7class Child {
8 @Output() notifyParent: EventEmitter<any> = new EventEmitter();
9 sendNotification() {
10 this.notifyParent.emit('Some value to send to the parent');
11 }
12}
13
14@Component({
15 selector : 'parent',
16 template : `
17 <child (notifyParent)="getNotification($event)"></child>
18 `
19})
20class Parent {
21 getNotification(evt) {
22 // Do something with the notification (evt) sent by the child!
23 }
24}