且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在不使用 IFrame 的情况下将两个不同的 Angular 2 应用程序嵌入到另一个 Angular 2 应用程序中

更新时间:2022-11-04 10:08:42

是的,它确实是可以解决的.angular2 框架支持让模块包含特性.因此,您可以根据实际应用程序名称而不是应用程序"命名应用程序模块.然后,您可以将 app1 和 app2 的那些模块包含在 app3 中.

Yes it really is solvable. The angular2 framework supports making modules to contain features. So you can name your application modules as per your actual app name rather than 'app'. Then you can include those modules of your app1 and app2 inside app3.

现在这一切意味着您拥有实际的代码库而不是应用程序的 url 地址.

Now all this means that you have the actual code base rather than the url address for the application.

这是一个非常基本的用例,Angular2 很好地解决了这个问题.你可以很容易地找到这方面的代码.你只需要在定义你的 app3 模块时提到导入数组.此导入数组将包含 app1 和 app2 的名称.

This is a very basic use case that Angular2 solves very well. You can find code for this very easily. You just have to mention imports array while defining your app3 module. This import array will contain names of app1 and app2.

希望这个答案能很好地指导您进行申请.

Hope this answer guides you well to make your application.