I need to update some data in parent component by calling a function in it after an event has occurred in the child component. Here my child components are in router outlet of parent
parentComponent.html:-
<div class="row">
Parent component
</div>
<router-outlet></router-outlet>
Parentcomponent.ts:-
fetchRequestsStatus(role, user) {
if (this.userRole) {
this.dashboardService.getStatusCount(role, user).subscribe(
res => {
console.log(res)
},
err => {
console.log(err)
})
}
}
Now on a button click in the child, I need to call function fetchRequestsStatus(role, user)
by passing a parameter from the child. I have seen @input @ output decorators for sharing data but here my child component is inside the router.
How can I proceed with this?