简体   繁体   English

是否可以像使用模块一样在Angular 2中延迟加载组件?

[英]Is it possible to Lazy load a component in Angular 2 like we can with a Module?

I have learnt that we can lazy load modules in an angular 2 application. 我了解到我们可以在angular 2应用程序中延迟加载模块。 But similarly is it possible to lazy load simply a component(instead of wrapping it in a module) : https://angular.io/docs/ts/latest/guide/ngmodule.html#!#lazy-load 但是类似地,也可以延迟加载简单的组件(而不是将其包装在模块中): https : //angular.io/docs/ts/latest/guide/ngmodule.html#!# lazy-load

Edit How to share resources like Components, Directives and Services between the main module and lazily loaded module? 编辑如何在主模块和延迟加载的模块之间共享组件,指令和服务等资源?

不,仅支持模块延迟加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM