Reputation: 67
I am new to Power Bi and trying to integrate the power bi report in my angular app.Follwing the code from https://github.com/microsoft/powerbi-client-angular/tree/main/Angular/demo. When i run the demo app separately as a new app its working fine. When i integrate the same code in my custom angular app , getting error for the html file . Below is the error Any help to fix the below issue ?
" Error: src/app/modules/auth/components/dashboard/dashboard.component.html:133:7 - error NG8001: 'powerbi-report' is not a known element:
133 <powerbi-report [embedConfig]="reportConfig" [cssClassName]="reportClass" [phasedEmbedding]="phasedEmbeddingFlag" [eventHandlers]="eventHandlersMap"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/modules/auth/components/dashboard/dashboard.component.ts:22:16 22 templateUrl: './dashboard.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component DashboardComponent.
Error: src/app/modules/auth/components/dashboard/dashboard.component.html:133:23 - error NG8002: Can't bind to 'embedConfig' since it isn't a known property of 'powerbi-report'.
133 <powerbi-report [embedConfig]="reportConfig" [cssClassName]="reportClass" [phasedEmbedding]="phasedEmbeddingFlag" [eventHandlers]="eventHandlersMap"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<div class="controls">
<ng-container *ngIf="isEmbedded; else embedReportFlow">
<!-- <button (click)="changeVisualType()">Change visual type</button> -->
<button (click)="hideFilterPane()">Hide filter pane</button>
<button (click)="setDataSelectedEvent()">Set event</button>
<label class="display-message">{{ displayMessage }}</label>
</ng-container>
<ng-template #embedReportFlow>
<label class="display-message position">
{{ displayMessage }}
</label>
<!-- <button (click)="embedReport()" class="embed-report">Embed Report</button> -->
</ng-template>
<ng-container *ngIf="isEmbedded">
<powerbi-report [embedConfig]="reportConfig" [cssClassName]="reportClass" [phasedEmbedding]="phasedEmbeddingFlag" [eventHandlers]="eventHandlersMap">
</powerbi-report>
</ng-container>
Upvotes: 0
Views: 844
Reputation: 374
What I found out from the demo application.
npm i powerbi-client-angular
and npm i [email protected]
packages.json
should then have these entries. See demo app package.jsonPowerBIEmbedModule
to your app.module.ts
file under imports
(See also in demo app app.module.ts):import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { PowerBIEmbedModule } from 'powerbi-client-angular';
import { AppComponent } from './app.component';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, HttpClientModule, PowerBIEmbedModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
Angular relies on package.json for managing dependencies and project configuration. Angular Module imports are used to organize and encapsulate code, enabling the use of components and features within the application.
Upvotes: 2