我正在尝试使用Angular 2创建类似门户网站的功能,该功能将提供基本导航和全局服务(例如身份验证),但允许其他开发人员创建自己的模块,这些模块基本上插入到门户中。
我正在使用angular-cli,并已通过项目内创建模块的快速概念验证(请参见下面的树),通过路由器(使用loadChildren)在app.module中进行惰性加载。每个子模块都有自己的路由器,并从父门户(app.module)基本分离。
最终,我希望将这些子模块移动到它们自己的项目中,但我完全不知道从何开始,似乎在线上很少有相关信息。如果有人知道示例或可以演示如何设置这一点,我将非常感激。
编辑:如果可能,我希望继续使用Angular-CLI功能来实现此目的。
这是我的目录结构。模块1、2和3需要移动到它们自己的项目中。
+-- app
│ +-- app.component.css
│ +-- app.component.html
│ +-- app.component.spec.ts
│ +-- app.component.ts
│ +-- app.module.ts
│ +-- module1
│ │ +-- dataflows
│ │ │ +-- dataflows.component.css
│ │ │ +-- dataflows.component.html
│ │ │ \-- dataflows.component.ts
│ │ +-- module1.component.css
│ │ +-- module1.component.html
│ │ +-- module1.component.ts
│ │ +-- module1.module.ts
│ │ \-- other
│ │ +-- other.component.css
│ │ +-- other.component.html
│ │ \-- other.component.ts
│ +-- index.ts
│ +-- module2
│ │ +-- module2.component.css
│ │ +-- module2.component.html
│ │ +-- module2.component.ts
│ │ \-- module2.module.ts
│ \-- module3
│ +-- dummy1
│ │ +-- dummy1.component.css
│ │ +-- dummy1.component.html
│ │ \-- dummy1.component.ts
│ +-- module3.component.css
│ +-- module3.component.html
│ +-- module3.component.ts
│ +-- module3.module.ts
│ \-- dummy2
│ +-- dummy2.component.css
│ +-- dummy2.component.html
│ \-- dummy2.component.ts
+-- index.html