Angular 2.0.1 Router EmptyError: no elements in sequence

前端 未结 2 885
一个人的身影
一个人的身影 2020-12-20 23:38

I\'m having trouble getting Angular 2 routing to work. I am using Angular 2 and Webpack. In the Angular 2 webpack starter, I noticed they had webpack generating their html a

2条回答
  •  失恋的感觉
    2020-12-21 00:32

    This bug is due to the last version of Angular's Router. Please remove revert back angular version or add pathMatch: 'full' to your routes.

    export const userRoutes = [
        { path: 'profile', component: ProfileComponent, pathMatch: 'full' },
        { path: 'login', component: LoginComponent, pathMatch: 'full' }
    ];
    
    
    export const appRoutes = [
        { path: '', redirectTo: '/events', pathMatch: 'full' },
        { path: 'user', loadChildren: './user/user.module#UserModule' }
    ];
    

    You can find the issue here

提交回复
热议问题