2016-07-30 54 views

回答

0

工作演示https://plnkr.co/edit/hXJ6ZRv81kt4rvWhxoBD?p=preview

const routes: RouterConfig = [ 

     { path: '', redirectTo: 'home', terminal: true }, 
     { path: 'home', component: HomeComponent}, 
     { path: 'dashboard', component: DashboardCompnent} 

]; 
+0

使用pathMatch: '全',而不是終端:在3.0.0-β2路由器 –

+0

真正用於或什麼意義pathMatch或終端是什麼? – Gary

+0

'RedirectTo'用於重定向到特定路徑.'PathMatch'用於檢查前綴或後綴的路徑(精確路徑)或匹配路徑(例如以'dash'開頭)。 – micronyks