Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Marrafeiro
Helper I
Helper I

Embed with API REST

Hi everyone,

 

I already saw posts with this problem, but all of them was a little old.

I'm embeding my power bi reports in a Angular project. I already can embed and show the report. 

But now i want change pages with a button. I already search everywhere and everything i found didn't work.

Anyone with this problem recently?

 

thank you in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

The call to powerBiService.embed(...) will return an object type of pbi.Embed by default.

In the React & Typescript project I am developing with - I can safely cast the output as type 'pbi.Report';
This object then has the function 'getPages' - which is not available on the more generic pbi.Embed object.

report = pbiService.embed(container, embedConfiguration) as pbi.Report;

 

You can safely cast embed objects to the expected type (Dashboard/Report/Tile) as long as it matches the configuration.

Unfortunately I dont have an Angular project to confirm if there is something else going on.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

HI @Marrafeiro 

I have this working with a couple of projects, 1 plain JS site - and 1 using React JS.
Assume you have tried something along the lines of the notes in the JavaScript Wiki? https://github.com/Microsoft/PowerBI-JavaScript/wiki/Page-Navigation

One thing to keep in mind is that the page name you need to supply is the internal name and not the page display name.
It is a good idea to use the 'report.GetPages' function in order to get the array of pages, before using one of the array items and setting it to be 'isActive'.

Yes, i already tried it. But it give an error in getPages. Says i'm working in an Embed type.

 

just for testing i have this:

var embedConfigurationIEmbedConfiguration = {
      type: 'report',
      id: "21c52b89-c19d-4df8-.........................",
      embedUrl:
      'reportId=21c52b89-c19d-4df8....................' +
      '&groupId=387dda6b-d685-4243-8a................',
      settings: {
        filterPaneEnabled: false,
        navContentPaneEnabled: false
        
      },
      accessToken: this.embed
    };
 
this.powerBiService.embed(this.pbiContainerElementembedConfiguration)
 
if i create a report with type Report
it don't let me do that:
report = this.powerBiService.embed(this.pbiContainerElement, embedConfiguration)
Anonymous
Not applicable

The call to powerBiService.embed(...) will return an object type of pbi.Embed by default.

In the React & Typescript project I am developing with - I can safely cast the output as type 'pbi.Report';
This object then has the function 'getPages' - which is not available on the more generic pbi.Embed object.

report = pbiService.embed(container, embedConfiguration) as pbi.Report;

 

You can safely cast embed objects to the expected type (Dashboard/Report/Tile) as long as it matches the configuration.

Unfortunately I dont have an Angular project to confirm if there is something else going on.

Thank you very much. showing your example helped me a lot. 

I was missing the casting in Embed object to Report Object.

Now i already can get the pages and change it.

 

Thank you a lot

Anonymous
Not applicable

Excellent - Glad you got it working!

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.