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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
prateekraina
Memorable Member
Memorable Member

Calling getPages() in Angular 4 gives error

Hi,

 

I need to embed a specific page on report load in Angular 4.

I am using the following snippet to get pages of the report so that i can then choose a specific page out of those. I don't want to hard code the page name.

 this.report.on('loaded', function () {
              this.report.getPages().then(function (pages) {
                                pages[1].setActive();
              });
                        });




Error Received: ERROR TypeError: Cannot read property 'getPages' of undefined

 

Can anyone help me in resolving it. 

 

Prateek Raina

1 REPLY 1
v-micsh-msft
Microsoft Employee
Microsoft Employee

The error messages seems a little odd.

Have you installed the Microsoft.PowerBI.JavaScript package?

https://github.com/Microsoft/PowerBI-JavaScript

 

Besides, try:

 report.on('loaded', () => {
        report.getPages().then(pages => pages[1].setActive());
    });

Reference

 

Regards,

Michael

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.