I'm currently working on a way to exclude a component when a specific module is routed in a lazy loading application.
For instance, in my AppComponent I have a router-outlet and a component above it:
<div>
<my-component></my-component> --> don't show if module is StartModule
<router-outlet></router-outlet>
</div>
This is how my routing configuration is set up:
export const routes: Routes = [
{
path: 'start',
loadChildren: './start/start.module#StartModule',
},
{
path: 'first',
loadChildren: './first/first.module#FirstModule'
},
{
path: 'second',
loadChildren: './second/second.module#SecondModule'
}
];
Is there a way to retrieve the routed module so that I can perform a check like this:
isStartModule(): boolean {
if (routedModule == StartModule) {
return true;
}
}
<my-component *ngIf="!isStartModule()"></my-component>
?