Estoy tratando de lograr esto con 'ngAfterViewInit' y '@ViewChild('iframeContainer') iframeContainer: ElementRef;'
<iframe #iframeContainer [src]="iframeUrl" id="kfsFrame" width="100%" frameBorder="0"></iframe>
.TS CÓDIGO DE ARCHIVO:
ngAfterViewInit(): void { this.injectIframe(); } private injectIframe(): void { const iframe = this.iframeContainer.nativeElement; const height:any = Math.max( iframe.scrollHeight, iframe.offsetHeight, iframe.clientHeight, iframe.scrollHeight, iframe.offsetHeight ); iframe.setAttribute('width', '100%'); console.log(height); iframe.setAttribute('height', height); iframe.setAttribute('frameBorder', '0'); iframe.addEventListener('load', this.iframeOnLoadtwo); } public iframeOnLoadtwo(): void { console.log('iframe loaded...'); }``` _______________________________________________ While consoling height [console.log(height);] in console log, it is taking default height which is very less than iframe content height. Currently iframe having scroller bar which I don't want and want height to fit the content.