I have 2 modules, one is sidenav, where I can select the menu and want to show component in content module
where have router-outlet
. I want to know what is the best way to do that? Have some router event
where I can just subscribe
in content module? Because I will use service
to emit
component and subscribe event in router-outlet
component, but I guess that is not best practice. Something like that:
Service:
private emit = EventEmitter<string>
emit(component: string): void {
this.emit.emit(component)
}
and in component I just subscribe in service emit
and use router.navigate
to show component in router-outlet
. Hope someone can help me =). Thanks