diego-d5000 / PowerBI-Angular2

Angular (Angular 2, Angular io) components based on "PowerBI-Angular" and "PowerBI-Javascript" to use PowerBI Embedded Features
10 stars 10 forks source link

fix(component): dont call embed on first change. #6

Open miguskar opened 6 years ago

miguskar commented 6 years ago

The embed() function is called twice in rapid succession on loading the component, once in onChanges, and once in ngOnInit. The second of which tries to load data into the existing frame which in some situations hasn't been inserted into the dom yet.

To avoid this behavior, this PR simply returns in the first onChanges call.

Please see stackblitz: app and source

This is the error message thrown: error message