最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I embed a Angular 5 app into HTML in another page? - Stack Overflow

programmeradmin6浏览0评论

Well I am working with a project and using Angular 5.2.0 where I have done a ponent with their service and some modules. The pany that want this ponent prefer include the angular app like a Widget in their page.

I am trying some code like this stackoverflow and this option but I don't understand how they are doing this. I want to know another way or a better explain about this issue.

Can I package all my app in a only javascript to include in the HTML page?

Well I am working with a project and using Angular 5.2.0 where I have done a ponent with their service and some modules. The pany that want this ponent prefer include the angular app like a Widget in their page.

I am trying some code like this stackoverflow and this option but I don't understand how they are doing this. I want to know another way or a better explain about this issue.

Can I package all my app in a only javascript to include in the HTML page?

Share Improve this question asked Aug 22, 2019 at 14:28 Aprendiendo SiempreAprendiendo Siempre 3731 gold badge9 silver badges21 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You need to create a custom Angular element and then use webponent polyfills (Still most browsers don't support web ponents natively) to load the angular element into any HTML page.

You can check the following URLs:

https://angular.io/guide/elements

https://blog.angulartraining./tutorial-how-to-create-custom-angular-elements-55aea29d80c5

Although I am not quite sure if it's supported in Angular 5. However Angular 6 does have support for custom elements.

The best solution I found it was use iframe tag in HTML. For example:

<iframe id="Example"
    title="Example"
    width="400"
    height="400"
    src="http://localhost/example">
</iframe>

Work fine. However, it's some slow. I hope help you.

发布评论

评论列表(0)

  1. 暂无评论