I have a parent component with three child components:
- Navigation - Navigate Between Pages.
- Pages - Loads pages using Route outlet(Employee, Department).
- Save Components - Saving that form once validated.
The code looks like:
<app-nav></app-nav>
<router-outlet></router-outlet>
<app-save></app-save>
So I want some way of communication between Pages (which loads dynamically when the route is called. It contains different types of forms) and Save. So once user click "save" from save component it should go to loaded component(employee, department) function, checks whether form is valid or not if yes then save the form.
I looked at many examples online:
- Communicate between sibling components Anguar 2 (This won't work as my sibling is loading dynamically).
- https://angular.io/guide/component-interaction
Also, I thought of creating a service but not sure how to get the function from the loaded components.
Any suggestion?