Show spinner before iframe loads (closed)


#1

Hi.
I am trying to add a spinner to the iframe div which should hide as soon as the iframe is loaded.

Is this any functionality like onload to check whether iframe is completely loaded to hide the spinner div and display the iframe div.


#2
<iframe src="...." (load)="onLoad()"></iframe>
class myComponent(){

  onLoad(): void {
    // do something
  }

}

#3

Thank you!!! I’ve been trying (onload) and similar variations, but didn’t realize it was just (load)

… OOHHH and now I see that onclick= uses (click). Makes sense :slight_smile:

Now that I finally have a callback, I see that it’s being called twice, looks like once when it’s starting and once when it’s done. Events look the same. Any way to get just the event when it’s done loading?


#4

perfect, this is cool.