Problem Statement
How can a child component send data or events to its parent?
Explanation
Use @Output() with EventEmitter in the child and listen for that event in the parent template. Emit values from the child when user actions occur.
Code Solution
SolutionRead Only
// child
@Output() saved = new EventEmitter<string>();
onSave(){ this.saved.emit(this.name); }
// parent
<app-child (saved)="handleSave($event)"></app-child>Practice Sets
This question appears in the following practice sets: