Angular 4嵌套路由失败,名为route-outlet

时间:2017-11-21 18:10:16

标签: angular

我在Angular 4应用程序中有一个多页面表单的命名路由器插座。

我的路线如下:

const appRoutes: Routes = [
{ path: '', component: CompA },
{ path: 'routeB', component: CompB },
{ path: 'routeC', component: CompC, children: [ 
  { path: '', component: subCompA, outlet: 'ruleManagerOutlet'},      
  { path: 'subrouteB', component: subCompB, outlet: 'ruleManagerOutlet' },
  { path: 'subrouteC', component: subCompC, outlet: 'ruleManagerOutlet'}
 ]},
{ path: 'healthcheck', component: HealthCheckComponent }
];

除此之外我的html如下所示:

<div class="content-area">
    <router-outlet name="ruleManagerOutlet"></router-outlet>
</div>

当我尝试点击routeC / subrouteB时出现以下错误:

ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL 
Segment: 'routeC/subrouteB'
Error: Cannot match any routes. URL Segment: 'newIntent/segmentation'
at ApplyRedirects.webpackJsonp.../../../router/@angular/router.es5.js.ApplyRedirects.noMatchError (router.es5.js:1466)

我不确定我到底错过了什么。提前谢谢!

编辑:为了更清楚,我有一个在主路由器插座中呈现的组件。在这个组件中,我想渲染多个子组件以实现多页面表单。

0 个答案:

没有答案