Forum Discussion
using powerbi-client with react
- 8 years ago
I am replying to myself as I think I have got closer and it might help others looking at this.
Eric_Zhang I looked at the Angular example yesterday and kinda reverse engineered in our example.
The problem was that I was trying to call an abstract which was wrong
pbi.Embed(/* Service */, /*Html Element */ ,config)
In the end I did the following:
New up the powerBi Service:
let powerbi = new pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory);
and call it passing in the config
// Embed the report and display it within the div container.
var reportContainer = document.getElementById('reportContainer');
var report = powerbi.embed(reportContainer, config);
I am replying to myself as I think I have got closer and it might help others looking at this.
Eric_Zhang I looked at the Angular example yesterday and kinda reverse engineered in our example.
The problem was that I was trying to call an abstract which was wrong
pbi.Embed(/* Service */, /*Html Element */ ,config)
In the end I did the following:
New up the powerBi Service:
let powerbi = new pbi.service.Service(pbi.factories.hpmFactory, pbi.factories.wpmpFactory, pbi.factories.routerFactory);
and call it passing in the config
// Embed the report and display it within the div container.
var reportContainer = document.getElementById('reportContainer');
var report = powerbi.embed(reportContainer, config);
This worked like a charm.
idk why this is not explicity in the documentation, thanks anyway.