Unable to redirect to Lazy Loaded module as default route/url on server start up

前端 未结 3 1280
Happy的楠姐
Happy的楠姐 2021-01-25 06:07

Good day folks,

I am having this issue in my Angular 2 application upon server startup (npm start).

I redirect the base route or base path to

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-25 06:46

    The () => notation actually worked for me. Below is my code regarding how I fixed it just by editing my routes.ts file

    app/routes.ts

    import { UserModule } from './user/user.module';
    
    export const appRoutes:Routes = [
      { path: 'user', loadChildren: () => UserModule},
      { path: 'login', component: LoginComponent},    
      { path: '', redirectTo: 'user/login', pathMatch: 'full'}
    ]
    

提交回复
热议问题