2016-09-19 86 views

回答

2

您可以使用redirectTo,如下所示。

當用戶試圖瀏覽到www.domain.com/user因爲redirectTo,他將被重定向到www.domain.com/user/profile

import { Routes,RouterModule } from '@angular/router'; 

let routes: Routes = [ 
    { path: '/user', redirectTo: '/user/profile', pathMatch: 'full'}, 
    { path: '/user/profile', component:somecomponent }, 
]; 

export const routing = RouterModule.forRoot(routes); 
+0

感謝您的快速響應! –

+0

不客氣! – micronyks