@Output & EventEmitter — Event Binding

With @Output and EventEmitter it’s the other way around. You can pass data back from the child to the parent component. Again, we declare a variable in the child, but this time with the @Output decorator and a new EventEmitter :

We want to emit an event to the parent component by doing the following:

On every button click in the child component we’re passing the text “Hello Angular 7” to a parent component.

In our parent component we can now set an event to the child selector ( <app-child> ). As you can see, we use the exampleOutput from the child, which has as value a method called exampleMethodParent with parameter $event .