Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

513
Views
¿Cómo establecer dinámicamente la altura del iframe en angular 9?

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.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!