是否可以阻止在URL中显示路径参数?
showProfile(customer){
this.router.navigate(['profile/' + customer.id, customer]);
}
结果:
http://localhost:3000/profile/10083;id=10083;company=AG...
我问,因为它在重新加载时崩溃了我的应用程序。
Error: Cannot match any routes.
修改
routing.ts
export const routes: Routes = [
{ path: '', redirectTo: '/customers', pathMatch: 'full' },
{ path: 'profile/:id', component: CustomerProfileComponent },
{ path: 'customers', component: CustomerListComponent },
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);