Angular 找不到要加载的主出口';t';

Angular 找不到要加载的主出口';t';,angular,angular2-routing,Angular,Angular2 Routing,我在angular 2中遇到了一个路由问题,我花了将近一天的时间试图找出问题所在 这是我的appmodule路由配置 RouterModule.forRoot([ { path: "Dashboard", component: DashBoardComponent, children: [ { path: "BenchMark", component: BenchmarkPortalComponent, outlet:"p

我在angular 2中遇到了一个路由问题,我花了将近一天的时间试图找出问题所在

这是我的appmodule路由配置

 RouterModule.forRoot([
        { path: "Dashboard", component: DashBoardComponent, children: [
            {
                path: "BenchMark", component: BenchmarkPortalComponent, outlet:"portals",children: [
                    { path: "pendingAccounts", component: PendingAccounts, outlet: "contacts" },
                    { path: "acceptedAccounts", component: AcceptedAccounts, outlet : "contacts" },
                    { path: "", component: BenchmarkPortalComponent }, 
                ]
            },                
            { path: "", component: DashBoardComponent }, 
        ]},

        { path: '', redirectTo: 'DashBoard', pathMatch: 'full' }          

    ])],
我的appcomponent有一个routeroutlet,仪表板组件有一个命名的路由器出口(name=“portals”),homecomponent有一个命名的routeroutlet(name=“contacts”)

但是当我加载页面时,我看到应用程序组件被加载,然后我出现了一个错误

core.umd.js:3491异常:未捕获(承诺中):错误:找不到要加载“t”的主出口
错误:找不到要加载“t”的主出口
在getOutlet(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4342:21)
在ActivateRoutes.ActivateRoutes(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4183:49)
评估时(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4128:60)
at Array.forEach(本机)
在ActivateRoutes.ActivateChildootes(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4128:31)
在ActivateRoutes.ActivateRoutes(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4193:28)
评估时(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4128:60)
at Array.forEach(本机)
在ActivateRoutes.ActivateChildootes(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4128:31)

在ActivateRoutes.activate(http://localhost:59784/node_modules/@angular/router/bundles/router.umd.js:4102:16)
周围是否有
*ngIf
?你能告诉我路由器插座的位置和放置方式吗?对不起,我花了一段时间才回来。我遇到的问题是,如果在任何父组件下有一个命名路由器putlet,它就不能正确路由。我的应用程序组件在html中具有名称,而我的基准组件和仪表板组件具有名称组件。当我从html中删除命名组件并从路由中删除插座时,它就开始正常工作。路径为空且没有子路径的路由需要
pathMatch:'full'
。我不知道这是否解决了你的问题。Plunker将有助于调试问题。