Forum Discussion

bukar's avatar
bukar
New Member
9 months ago
Solved

Power BI Embedding in Angular

I successfully embedded Power BI reports into my Angular application, and most features are working as expected. I am currently implementing a state-saving and sharing mechanism that allows users to ...
  • bukar's avatar
    bukar
    9 months ago

    I have solved the issue myself, here is the solution I found for people with a similar situation:

     

    In addtion to tracking the state with the bookmarks.capture function I am tracking also if a bookmark was clicked:

            report.on('bookmarkApplied', async (event) => {
                const eventDetail = event.detail as BookmarkEventDetail;
                const bookmarkName = eventDetail.bookmarkName;
                localStorage.setItem(this.namedBookmarkStorageKey, bookmarkName);
                await this.manageBookmarkState(report);
            });

    Then afterwards if a bookmark was applied when my report is loaded I am applying the bookmark by its name 

            report.on('loaded', async () => {
                this.onSuccessReportLoaded();
                const namedBookmark = localStorage.getItem(
                    this.namedBookmarkStorageKey,
                );
                if (namedBookmark) {
                    report.bookmarksManager.apply(namedBookmark);
                }
            });

     

    It is not a elegant solution but I couldnt find another way