Thanks for the reply. My report variable is definately in the same context. Something very odd is happening here, I left things as they were yesterday evening, came into work this morning, read your post, and ran my project without any errors.
The only thing I can think of is that when I created my MVC project I downloaded the Microsoft Power BI for ASP.NET MVC package. When I encountered this problem, I checked the versions installed for each of the dependant Power BI packages and noticed that all where the latest except for the Microsoft.PowerBI.Javascript package that although was the same version as the other Power BI packages v1.1.0 it was not the latest. The latest version was several version newer and so installed that and did some unsuccessful testing and then created this post.
My code:
$(function () { var container = $('#powerBIContainer'); var accessToken = container.attr('powerbi-access-token'); var embedUrl = container.attr('powerbi-embed-url'); var biType = container.attr('powerbi-type'); var reportId = container.attr('powerbi-report-id'); var config = { type: biType, accessToken: accessToken, embedUrl: embedUrl, id: reportId, settings: { filterPaneEnabled: true, navContentPaneEnabled: true } }; var reportContainer = $('#powerBIContainer')[0]; var report = powerbi.embed(reportContainer, config); report.on("loaded", function () { console.log('report.on - loaded'); }); });
All is still working, thanks again.