Angular Power BI报告嵌入角路径变化的破坏
我有一个包含html容器的angular组件,嵌入将在其上进行。现在在路由更改中,这个组件正在被销毁,它包含报告的html容器也将被销毁。当用户返回报告路径时,组件将再次初始化并从头重新嵌入报告,删除用户对报告所做的任何更改 我想知道是否有办法使该报告在其组件被销毁后仍然有效。我考虑了一些方法,比如让嵌入过程发生在从显示报表的组件调用的服务中。问题是我看不到如何实际地设置它,服务应该返回什么:html容器还是pbi.embed()方法的结果 这是当前从我的报表查看器组件onInit调用的方法。它注入了powerbiService来获取嵌入信息的报表。实际嵌入目前正在组件级别进行:Angular Power BI报告嵌入角路径变化的破坏,angular,typescript,powerbi,angular-services,powerbi-embedded,Angular,Typescript,Powerbi,Angular Services,Powerbi Embedded,我有一个包含html容器的angular组件,嵌入将在其上进行。现在在路由更改中,这个组件正在被销毁,它包含报告的html容器也将被销毁。当用户返回报告路径时,组件将再次初始化并从头重新嵌入报告,删除用户对报告所做的任何更改 我想知道是否有办法使该报告在其组件被销毁后仍然有效。我考虑了一些方法,比如让嵌入过程发生在从显示报表的组件调用的服务中。问题是我看不到如何实际地设置它,服务应该返回什么:html容器还是pbi.embed()方法的结果 这是当前从我的报表查看器组件onInit调用的方法。它
this.powerbiService
.getReportEmbedInfoById()
.subscribe(async (data) => {
if (this.pbiContainerElement) {
const embedConfig = this.powerbiService.buildEmbedConfig(data);
powerbi.reset(this.pbiContainerElement);
this.myReport = powerbi.embed(this.pbiContainerElement, embedConfig);
// report.off removes all event handlers for a specific event
this.myReport.off('loaded');
// report.on will add an event handler
this.myReport.on('loaded', () => {
this.powerbiService.handleTokenExpiration(this.myReport);
loadedResolve();
// this.myReport.off("loaded");
});
});
我在这里提供了更多细节,以防得到答案:
进行嵌入的函数如下所示:
this.myReport = powerbi.embed(this.pbiContainerElement, embedConfig);
它接受一个html容器并返回对嵌入报表的引用。
现在的问题是,我们如何将这个容器从服务传递到组件,这样当组件被破坏时,它可以再次嵌入相同的html容器
谢谢你的支持