我正在尝试让多个路由器插座与同一路径上的不同组件一起工作,然而,以下代码不起作用。
路由:
const routes: Routes = [
{ path: 'products', component: ProductComponent},
{ path: 'products', component: ProductHeaderComponent, outlet: 'header-route' },
{ path: 'products', component: ProductFooterComponent, outlet: 'footer-route' }
];Html:
<router-outlet></router-outlet>//Primary Outlet
<router-outlet name="header-route"></router-outlet>
<router-outlet name="footer-route"></router-outlet>主插座工作正常。
命名网点、页眉路由和页脚路由不起作用。
发布于 2019-09-08 23:33:30
您可以使用(outletname: route)使用多个路由器插座并访问辅助路由器url。示例:
localhost:4200/loginpage(header-route: products)现场示例:Stackblitz
https://stackoverflow.com/questions/54445276
复制相似问题