SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function objToRoute(obj: any): Route {
  2.    // convert it to route and return
  3. }
  4.  
  5. const routes: Routes = [
  6.    path: '',
  7.    component: SomeComponent,
  8.    children: [
  9.       objToRoute(specialObject),
  10.       {
  11.                 path: '**',
  12.                 component: StubComponent
  13.       }
  14.    ]
  15. ]
  16.  
  17. @NgModule({
  18.     imports: [RouterModule.forChild(routes)],
  19.     exports: [RouterModule]
  20. })
  21. export class SomeRoutingModule {}
  22.      
  23. function objToRoute(obj: any): Route {
  24.    return obj;
  25. }
  26.  
  27. const routeObj: Route = {
  28.     path: 'somePath',
  29.     pathMatch: 'full',
  30.     loadChildren: () => import('pathToDir/someLazy.module').then(m => m.SomeLazyModule)
  31. }
  32.  
  33. const routes: Routes = [
  34.    path: '',
  35.    component: SomeComponent,
  36.    children: [
  37.       objToRoute(routeObj),
  38.       {
  39.                 path: '**',
  40.                 component: StubComponent
  41.       }
  42.    ]
  43. ]
  44.  
  45. @NgModule({
  46.     imports: [RouterModule.forChild(routes)],
  47.     exports: [RouterModule]
  48. })
  49. export class SomeRoutingModule {}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top