在应用程序的开始我想加载子路由.
现在是URLcome但是相应的组件没有加载到该部分,但是当再次点击实际的URL时.
像route configure一样
const appRoutes: Routes = [ { path: 'a', component: AComponent, children:[ { path:'x',component:AXcomponent } ] }, { path: 'b', component: bComponent, } ]
现在我想加载路径a/x
如何在页面开头加载?
添加空路径路径作为自动重定向
const appRoutes: Routes = [ { path:'', redirectTo: 'a', pathMatch: 'full' }, { path: 'a', component: AComponent, children:[ { path:'', redirectTo: 'x', pathMatch: 'full' }, { path:'x', component: AXcomponent } ] }, { path: 'b', component: bComponent } ];