Forum Discussion
dpoleon
8 years agoRegular Visitor
powerbi-client 2.4.2
Hi, I am trying to use the powerbi-client in an angular 4 application, I am getting to following error: 'getPages' does not exist on type 'Embed'. Any help would be greatly appreciated....th...
Eric_Zhang
Microsoft Employee
8 years agoThe getPages works with powerbi-client 2.4.2 in my test, what's going on if you test in below html?
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
<script src="powerbi.js"></script>
<script type="text/javascript">
window.onload = function () {
// Read embed application token from Model
var accessToken = "embeded token";
// Read embed URL from Model
var embedUrl = "embed url";
// Read dashboard Id from Model
var embedReportId = "reportid";
// Get models. models contains enums that can be used.
var models = window['powerbi-client'].models;
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId ,
settings: {
filterPaneEnabled: true
}
};
// Get a reference to the embedded dashboard HTML element
var dashboardContainer = $('#reportContainer')[0] ;
// Embed the dashboard and display it within the div container.
var reports = powerbi.embed(dashboardContainer, config);
reports.on('loaded', function(event)
{
var data = event.detail;
//console.log(JSON.stringify(data, null, ' '));
console.log('****************************************************');
console.log(reports.getPages());
console.log('****************************************************');
})
}
</script>
<div id="reportContainer"></div>
</html> dpoleon
8 years agoRegular Visitor
Thank you for your reply,
I have implemented your suggested code but still getting nothing coming back for "reports.getPages()"...worryingly I'm not getting anything at all in the console window for the data variable even though the "filterPaneEnabled: true" is being applied.
Still getting "Property 'getPages' does not exist on type 'Embed'."
Is this because I am trying to use "powerbi-client" in an Angular 4 application?
Regards