具有多个视图的角度路由器

时间:2017-04-04 16:50:57

标签: angular angular-routing

有什么办法可以为同一路线渲染同一级别的两个组件吗?

路由器配置(部分)

const routing: Routes = [
{
    path: 'base',
    component: ParentComponent,
    children: [
        {path: '', redirectTo: 'route1'},
        {path: 'route1', children: [
            {path: '', component: Route1Component1, outlet: 'outlet1'},
            {path: '', component: Route1Component2, outlet: 'outlet2'}]},
        {path: 'route2', children: [
            {path: '', component: Route2Component1, outlet: 'outlet1'},
            {path: '', component: Route2Component2, outlet: 'outlet2'}]}
    ]
}];

这里是html我希望它呈现:

<div>
    <div>
        <router-outlet name="outlet1"></router-outlet>
    </div>
    <div>
        <router-outlet name="outlet2"></router-outlet>
    </div>
</div>

0 个答案:

没有答案