0

Angular – Pass Data from Child to Parent Component by Emitting Events

This post talks about passing data from child to parent component via emitting an event.

Requirements

  • Angular CLI 7.3.9
  • NPM 6.4.1
  • Node v8.11.3
  • Internet connection

From Parent to Child Component

Please read Angular – Pass Data from One Component to Another

The Child Component

We use @Output decorator and EventEmitter class.

The Parent Component

The event is captured and passed to the onAddedItem function which adds the data to the itemList property in app.component.ts.

In app.component.ts

Testing

Download the Files

https://github.com/Turreta/Angular-Pass-Data-from-Child-to-Parent-Component-by-Emitting-Events

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert