Pass data between components

Pass data between components


on my Angular 8 project I have a summary.component.ts which holds a number of products which I am passing onto another component summary-dialog.component.ts I would like to pass the number of products back to the summary.component.ts file please help?


Hi @jbiddulph

If you were to provide a link to a live demo or a github repo, we might be able to help you more effectively.

I am not familiar with the particular framework, but without the code implementing your components we can only give you general advice based on Angular’s own documentation.

You can either make parent listen for child components events like this
<app-summary-dialog (myCallback)="changeNumberOfProducts()"></app-summary-dialog>
or you can import shared service class in both parent and child components and watch it.
Googling angular parent child component interaction should help more.