I have a question, I hope you can guide me, I am working in an angular application with Firestore and I need to call the ngOnInit method of a component from another component, the problem with this is that both components are integrated in different parts. The first is a header that is inside a component that contains more headers, this uses a component that contains a Router-Outlet, which is where I need to call the ngOnInit method of the Header.
This is the ngOnInit method of the app-header-user that I want to call
Component({
selector: 'app-header-user',
templateUrl: './app-header-user.component.html',
styleUrls: ['./app-header-user.component.scss']
})
export class HeaderUserComponent implements OnInit{
ngOnInit() {
Some code...
}
}
The first component (header) is contained like this along with other headers in app-header:
<ul>
<li><app-header-notify></app-header-notify></li>
<li><app-header-user></app-header-user></li>
</ul>
This component that contains the headers is contained in a component together with a Router-Outlet.
<app-header></app-header>
<div class="inner-content">
<router-outlet></router-outlet>
</div>
I need to call the ngOnInit method of the app-header-user from a component contained in the Router-Outlet
I appreciate your attention and I hope you can help me.