Let's consider a scenario where the main routing module is defined as follows:
// app-routing.module.ts
const appRoutes: Routes = [
{
path: 'login',
component: LoginComponent
},
{
path: 'auth',
component: MasterPageComponent,
canActivate: CanActivateGuard
}
];
Then, in another file, there is a routing module specifically for a feature
:
// feature-routing.module.ts
const featureRoutes: Routes = [
{
path: '/feature',
component: FeatureComponent
}
];
The question arises on how to align the routes from the feature module under the main module in a way that allows access like this:
/auth/feature
While lazy loading can achieve this, it is desired to load this module eagerly instead. Is there a way to programmatically "mount" these routes?