0
如何在新版Angular 2路由器中使用重定向至路線,如測試版中的'redirectTo'路線?任何'plnkr.co'例子都非常感謝。在新的Angular2路線中重定向
如何在新版Angular 2路由器中使用重定向至路線,如測試版中的'redirectTo'路線?任何'plnkr.co'例子都非常感謝。在新的Angular2路線中重定向
工作演示:https://plnkr.co/edit/hXJ6ZRv81kt4rvWhxoBD?p=preview
const routes: RouterConfig = [
{ path: '', redirectTo: 'home', terminal: true },
{ path: 'home', component: HomeComponent},
{ path: 'dashboard', component: DashboardCompnent}
];
使用pathMatch: '全',而不是終端:在3.0.0-β2路由器 –
真正用於或什麼意義pathMatch或終端是什麼? – Gary
'RedirectTo'用於重定向到特定路徑.'PathMatch'用於檢查前綴或後綴的路徑(精確路徑)或匹配路徑(例如以'dash'開頭)。 – micronyks