Closed celvin closed 5 years ago
Hi there,
Thanks for using the library. About the error, it seems that the 'report' object is of type 'Embed' whereas it should be of type 'Report' as the 'getPages' API is part of the 'Report' class. You can simply typecast it to 'Report' type or try the code below:
import { Report } from 'report'; // This is part of powerbi-client library so you will need to install the same
embedReport() {
const report: Report = <Report>(this.powerBiService.embed(this.pbiContainerElement, config));
// Now all 'report' object APIs should work
report.on('loaded', function(event): any {
report.getPages().then(function(pages) {
console.log('report loaded, number of pages: ', pages.length);
// We only want to handle the 'loaded' event once
report.off('loaded');
});
});
}
Thanks, It worked very well, thanks.
now just a small lint on then(function(pages) .... expected call-signature to have a typedeftslint(typedef)
I have changed it to:
report.getPages().then(pages => {
console.log('report loaded, number of pages: ', pages.length);
report.off('loaded');
});
this issue can be considered as closed, thank you!
Not working for me.
I'm using your nice wrapper library with Angular 7, and it is almost fully working, I am getting just some typescript compiling errors like this:
error TS2339: Property 'getPages' does not exist on type 'Embed'.