Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function objToRoute(obj: any): Route {
- // convert it to route and return
- }
- const routes: Routes = [
- path: '',
- component: SomeComponent,
- children: [
- objToRoute(specialObject),
- {
- path: '**',
- component: StubComponent
- }
- ]
- ]
- @NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
- })
- export class SomeRoutingModule {}
- function objToRoute(obj: any): Route {
- return obj;
- }
- const routeObj: Route = {
- path: 'somePath',
- pathMatch: 'full',
- loadChildren: () => import('pathToDir/someLazy.module').then(m => m.SomeLazyModule)
- }
- const routes: Routes = [
- path: '',
- component: SomeComponent,
- children: [
- objToRoute(routeObj),
- {
- path: '**',
- component: StubComponent
- }
- ]
- ]
- @NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule]
- })
- export class SomeRoutingModule {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement