简体   繁体   English

将 Angular 应用程序嵌入为小部件

[英]Embedding Angular application as a widget

I've build an Angular app that would be embedded onto a page as a widget, however unable to get it running at full height, is there a better way I can inject this Angular application onto a page?我已经构建了一个 Angular 应用程序,该应用程序将作为小部件嵌入到页面中,但是无法使其全高运行,有没有更好的方法可以将此 Angular 应用程序注入页面?

Prior to using Angular i've done this using an iFrame and having the document embedded post a message back to the parent page to resize the iFrame to the document height which worked fine, however the document.body.scrollHeight in Angular seems to behave differently and is the window size Prior to using Angular i've done this using an iFrame and having the document embedded post a message back to the parent page to resize the iFrame to the document height which worked fine, however the document.body.scrollHeight in Angular seems to behave differently并且是 window 大小

So it appears that my.main-container was display:flex;所以看起来 my.main-container 是 display:flex; which was making document.body.scrollHeight return the window size rather than the document.这使得 document.body.scrollHeight 返回 window 大小而不是文档。

Changing.main-container to display: block fixed the issue更改.main-container to display: block 修复了问题

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

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