zag*_*oll 6 angular2-routing angular
我有node.js应用程序,托管angular2应用程序.整个应用程序使用这样的延迟加载:
export const routes: Routes = [
{
path: '', component: MyComponent,
children: [
{
path: 'lazy',
loadChildren: '../common/lazy/lazy.module#LazyModule'
}
}
]
Run Code Online (Sandbox Code Playgroud)
我公司的另一个团队正在构建另一种软件,但我们想重用一些模块.我们不想严格共享代码库,而是公开托管模块并让它由应用程序本身加载,以便我们可以做这样的事情
export const externalRoutes: Routes = [
{
path: 'externalModule',
loadChildren: 'http://mymodules.host/lazy.module#LazyModule'
}
]
Run Code Online (Sandbox Code Playgroud)
是否可以在"实时"应用程序中加载模块?我知道有类似动态组件加载器的东西,但我们需要加载一个包含大量组件的模块.
出于安全原因,您无法加载项目外部的模块。
作为其他团队创建 Angular 库项目,您可以做什么
https://angular.io/guide/creating-libraries
并将其作为模块使用,将其添加为package.json中的依赖项