While using router-outlet, i have used “active” event ton take child component instance.
A router outlet will emit an activate event any time a new component is being instantiated, and a deactivate event when it is being destroyed.
Sample - https://stackblitz.com/edit/angular-router-basic-example-a9jpsd?file=app/app.component.ts
Example code –
App.component.html
<div class="container">
<router-outlet (activate)="onActivate($event)"></router-outlet>
</div>
App.component.ts
public onRouterOutletActivate(event : any) {
console.log(event);
}
But child component not get displayed at initial loading, but element is in DOM.
Any idea about this problem?