angulariframeiframe-resizer

use iframe-resizer for an iframe containing Angular


Inside a web server, I would like to create an html page that through an iframe embeds the content of an Angular component that can change its vertical height. So I went from Angular code to having the html/javascript/css files through the command: ng build. Now I would like to create an index2.html page that embeds the index.html page:

<iframe src="index.html"></iframe>

and that adapts to the change in vertical dimension. I was reading the documentation of the iframe-resizer library (https://github.com/davidjbradshaw/iframe-resizer), but I can't understand how I should change my approach to the problem and if I should change something to my angular code and perform a new build.


Solution

  • If your only using Angular in the iframe, then you just need to include the iframeresizer.contentwindow.js file on your embedded page and then copy the code from the example page for your parent page.