Ayz*_*Pat 1 typescript angular-routing angular
我正在使用此代码进行路由
{ path: 'dashboard', loadChildren: './dashboard#DashboardModule'},
{ path: '', children: [
{ path: '', component:DashboardComponent, children: [
{ path: '', redirectTo:'dashboard/first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent }]
},
]},
Run Code Online (Sandbox Code Playgroud)
在这里,当URL是/dashboard我需要它路由到/dashboard/first...
我该如何实现?
您已经在Dashboard组件中。仅使用first,不使用dashboard/first。
{ path: '', children: [
{ path: '', component:DashboardComponent ,
children:[
{ path: '', redirectTo:'first',pathMatch:'full' },
{ path: 'first', component: FirstComponent },
{ path: 'second', component: SecondComponent },
]
},
]},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1519 次 |
| 最近记录: |