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
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
Add pathMatch: 'full'
{ path: '', component: HomeComponent, pathMatch: 'full' },
otherwise both routes
{ path: '', component: HomeComponent },
{ path: 'schedule', component: ScheduleComponent },
match on route /schedule
because ''
matches, but doesn't consume anything from the route and then also 'schedule'
matches.