I have a Submitbutton in the parent component namely
personDetails.
personDetailshas many
person` components. Whenever I click on the Submit button, I want to call a method in child component.
How can I emit an event from a parent to a child component using @Output
?
Its easy to do it from the child to the parent. I want to access a value of the child component, hence I need to emit an event from parent to child.
Best Answer
You can create one service which is shared between your parent and child component in which you can define
Observable
so that you can subscribe to thatObservable
from child and perform some action when you receive some value from parent.//parent.component.ts
//child.component.ts