However, when the page is loaded and the power BI library tries to add stuff to the iframe, it seems as though the iframe has not been added to the page yet. You can see in the screenshot below that the contentWindow of the iframe is undefined, which means that it hasn't beeen added to the DOM yet.
And the following error is thrown:
By waiting until AfterViewInit we should be able to be sure that the iframe has been added to the page before loading data.
This only happens on page load, so if we open a sidepane or something, the iframe is loaded properly.
I haven't been able to test if this PR actually works, as I can't seem to get my fork up and running with our project. Any advice on this is welcome.
Some backstory to this PR:
We're using this component inside a
mat-tab-group
from angular material as such:However, when the page is loaded and the power BI library tries to add stuff to the iframe, it seems as though the iframe has not been added to the page yet. You can see in the screenshot below that the
contentWindow
of the iframe is undefined, which means that it hasn't beeen added to the DOM yet.And the following error is thrown: By waiting until
AfterViewInit
we should be able to be sure that the iframe has been added to the page before loading data.This only happens on page load, so if we open a sidepane or something, the iframe is loaded properly.
I haven't been able to test if this PR actually works, as I can't seem to get my fork up and running with our project. Any advice on this is welcome.