ngIf else not working on async pipe in Angular 5
Clash Royale CLAN TAG#URR8PPP
ngIf else not working on async pipe in Angular 5
I have an ngIf else and the else doesn't get triggered. if the line #1 keeps showing and the else condition never shows. I don't think there's a problem in my ts file. I can see the booleans changing to true or false. I put a timeout just saw I can see because everything happens so fast.
HTML
<div class="value" *ngIf="premiseCharge$ | async as pc; else spinner">
$pc.calculatedCharge USD
</div>
<ng-template #spinner>
<div class="loadingSpinner" *ngIf="isLoading"><img src="assets/spinner.svg" alt="spinner"></div>
</ng-template>
TS
reCalcultePremiseCharge(pickDate: Date)
this.eBalanceDueFlag = false;
this.balanceDueLoader.emit(true);
let pc: PremiseCharge;
pc = pickupDate: this.dateFormatBuilder(pickDate) ;
this.isLoading = true;
this.premiseCharge$ = this.cpcService
.calcPremiseCharge(this.equipmentSummary.equipmentID, pc)
.pipe(
map(pc =>
setTimeout(() =>
this.isLoading = false;
this.balanceDueLoader.emit(false);
, 2000);
return pc;
)
);
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.