How does a child component send data to its parent?

Angular components and templates · Freshers

Model answer

The child declares an output and emits events. In current Angular: saved = output<string>() and then this.saved.emit(value). In the parent template you listen with (saved)="onSaved($event)". The classic style uses @Output() with an EventEmitter.

Keep the pattern simple: data down with inputs, events up with outputs. For siblings or distant components, use a shared service.

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions