I am trying to exclude a component if a certain module has been routed in a lazy loading application.
For example in my AppComponent i am using router-outlet and above a component:
<div>
<my-component></my-component> --> don't show if module is StartModule
<router-outlet></router-outlet>
</div>
My routing configuration looks like following:
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 parameter to receive the routed module to make a check like
isStartModule(): boolean {
if (routedModule == StartModule) {
return true;
}
}
<my-component *ngIf="!isStartModule()"></my-component>
?