Unable to read property "loadChildren" null

I just upgraded to angular-cli@1.0.0-beta.25.5and @angular/common@2.4.2, and one of my routes did not start.

I have TemplateModulewhich

export const TEMPLATE_ROUTES: Routes = [
  {
    path: 'template',
    component: TemplateComponent,
    children: [
      {
        path: 'editor',
        component: TemplateEditorComponent
      }, {
        path: 'selector',
        component: TemplateSelectorComponent
      }
    ]
  }
];

They can be used in two different modules. The first conversion is not required

export const PREVIEW_ROUTES: Routes = [
  ***
  ...TEMPLATE_ROUTES
];

but on the second

export const CONTENT_ROUTES: Routes = [
  ***
  ...TEMPLATE_ROUTES.map(parseTemplateRoutes)
];

export function parseTemplateRoutes(route) {
  route.canActivate = [CannotEnterMultistep];
  return route;
}

Prior to this update, it worked and worked, but now I get

ERROR in Cannot read property 'loadChildren' of null

Any idea on how to do this without replicating an array of template templates?

+4
source share

Source: https://habr.com/ru/post/1667135/


All Articles