I would show a loader if data is not ready without making multiple requests
So I would use as
in order to reuse the request.
<div class="loading-overlay" *ngIf="this.indicatorService.loadingIndicators[this?.indicatorName] && !(values$ |async as values) && !(valuesNat$ |async as natValues) ">
<app-loading-spinner textBloc="LOADING_DATA_IN_PROGRESS"></app-loading-spinner>
</div>
<div [hidden]="!values">
<app-chart-multi [type]="type" [name]="indicatorName" [valuesNat]="natValues" [values]="values" [objectifs]="objectifs" (weekLegend)="displayCurrentPeriodFormat()"></app-chart-multi>
</div>
Actually I get error
[ERROR ->]<app-chart-multi [type]="type" [name]="indicatorName" [valuesNat]="natValues" [values]="values" [obje")
values
is available only inside of *ngIfed element. try to use else
<ng-template #loader>loading...</ng-template>
<ng-contaier *ngIf="this.indicatorService.loadingIndicators[indicatorName] && !(values$ |async as values) && !(valuesNat$ |async as natValues); else loader">
<app-chart-multi [type]="type" [name]="indicatorName" [valuesNat]="natValues" [values]="values" [objectifs]="objectifs" (weekLegend)="displayCurrentPeriodFormat()"></app-chart-multi>
</ng-container>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.