angular 2 - 从json加载的ROUTES中找不到组件的组件工厂(即使使用entryComponents配置)

时间:2017-02-03 09:18:57

标签: angular angular2-router

我的应用程序需要基于用户动态加载路由,因此路由路径从数据库接收为json,并使用JSON Parser解析为Routes对象。如果使用loadChildren参数而不是component参数,动态路由配置运行良好,因此在这种情况下,应用程序路由到/dash/contacts成功,但在路由到{{ 1}}应用程序抛出

错误:\home

我已尝试在No component factory found for HomeComponent文件的HomeComponent entryComponents: [HomeComponent ]中配置NgModule,但问题未解决

路线Json:

app.modules.ts

Json to Routes

[{"path":"dash","loadChildren":"app/dash/dash.lazy.module#DashBoardModule"},
 {"path":"contacts","loadChildren":"app/contacts/contacts.lazy.module#ContactsModule"},
{"path":"home","component":"HomeComponent"}, 
{"path":"home","component":"HomeComponent",
"children": 
[{ "path": "child",   "loadChildren":"app/child/child.lazy.module#LazyModule", 
"outlet": "mainoutlet" }]
}]

0 个答案:

没有答案