简体   繁体   English

Angular:如何动态加载组件? (在编译应用程序时组件未知)

[英]Angular : How to load components dynamically? (component is unknown while compiling application)

I have an use case where, 我有一个用例,

  1. In Angular application user can upload any angular component. 在Angular应用程序中,用户可以上传任何角度分量。
  2. The uploaded angular component now available to use inside same application. 现在可以在同一应用程序中使用已上传的角度分量。

Angular application is not aware of components that being uploaded at compile time. Angular应用程序不知道在编译时上载的组件。 I do not want to stop, recompile and rerun the application. 我不想停止,重新编译并重新运行该应用程序。

Is there any way to do this? 有什么办法吗?

Currently not possible. 目前不可能。 Maybe one day it'll be as easy to export a native Web Component with ng-cli as generating a component. 也许有一天,使用ng-cli导出本机Web组件与生成组件一样容易。 Check out https://github.com/robwormald/angular-elements mr. 查看https://github.com/robwormald/angular-elements先生。 Wormald has done some experimenting on Angular->Custom elements. Wormald对Angular-> Custom元素做了一些实验。

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

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