如何在不使用 IFrame 的情况下将两个不同的 Angular 2 应用程序嵌入到另一个 Angular 2 应用程序中 [英] How to embed two different Angular 2 applications inside another Angular 2 application without using IFrame

查看:33
本文介绍了如何在不使用 IFrame 的情况下将两个不同的 Angular 2 应用程序嵌入到另一个 Angular 2 应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的 Angular 2 应用程序(比如 app1 和 app2)部署在两个不同的服务器( server1 和 server2 )上,我想在第三个 Angular 2 应用程序( app3 )中使用或嵌入这些应用程序,该应用程序将部署在一个不同的服务器( server3 ).是否可以在app3中不使用IFrame解决上述问题.

I have two different Angular 2 applications ( say app1 and app2 ) deployed on two different servers ( server1 and server2 ) and i want to use or embed those applications inside a third Angular 2 application ( app3 ) which will be deployed on a different server ( server3 ). Is it possible to solve the above problem without using IFrame in app3.

推荐答案

是的,它确实是可以解决的.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.

这篇关于如何在不使用 IFrame 的情况下将两个不同的 Angular 2 应用程序嵌入到另一个 Angular 2 应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆