【发布时间】:2017-03-17 22:04:37
【问题描述】:
我正在尝试使用 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
【问题讨论】:
标签: angularjs angular angular2-routing