Default route redirect not working for lazy loaded routes in Angular 2

后端 未结 2 1258
余生分开走
余生分开走 2021-02-07 07:41

I have an app that is divided into a authenticated section (InternalRootComponent) and an anonymous section (ExternalRootComponent).

Everything works fine when I naviga

2条回答
  •  情话喂你
    2021-02-07 08:02

    If you're using lazy loading routes, the Global routes must also be included in app.module.ts in order the redirectTo and other routes functionality to work everywhere in the app module.

    I architected my project where the coreModule is outsourced from the appModule where the main routes is imported in it

    And in my appModule the coreModule is imported as well as the 'AppRoutingModule' (my main routes)

提交回复
热议问题