我的应用程序需要基于用户动态加载路由,因此路由路径从数据库接收为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" }]
}]