1import { Component, Output, EventEmitter } from '@angular/core';
2
3@Component({
4 selector: 'app-child',
5 template: `
6 <button (click)="sendMessage()">Send Message</button>
7 `,
8 styleUrls: ['./child.component.css']
9})
10export class ChildComponent {
11
12 message: string = "Hola Mundo!"
13
14 @Output() messageEvent = new EventEmitter<string>();
15
16 constructor() { }
17
18 sendMessage() {
19 this.messageEvent.emit(this.message)
20 }
21}
22