I have a secondary router outlet in my app module as below.
<router-outlet></router-outlet> <==== PRIMARY
<mat-sidenav-container>
<mat-sidenav mode="over">
<router-outlet name="side"></router-outlet> <=== SECONDARY NAMED OUTLET
</mat-sidenav>
</mat-sidenav-container>
Then I have a feature module with child routes as below,
@NgModule({
RouterModule.forChild([
{
path: "orders",
component: OrdersComponent,
children: [
{
path: "add",
component: AddOrderComponent,
outlet: "side", <=== SAYING PATH TO USE SECONDARY OUTLET DEFINED IN APP MODULE
},
]
},
])
})
export class OrdersModule {}
I am trying to display AddOrderComponent inside secondary outlet (name "side") in my app module, but the outlet is NOT activating.
<a [routerLink]="['../orders',{outlets: { side: ['add']}}]">
Add New Order
</a>
If I move the secondary outlet into any other component inside the feature module it's working.
What special I need to define in routerLink or route definition to access secondary router outlet defined in AppModule from a feature module?
Note: This is NOT a lazy-loaded module. Importing into app module while bootstrapping itself.
Thanks.