I have the following Angular typescript and html template and it prompts the captioned error when build.
Typescript:
import { ChangeDetectionStrategy, Component, Inject, OnDestroy } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { select, Store } from '@ngrx/store';
import { Observable, BehaviorSubject } from 'rxjs';
import { tap, map } from 'rxjs/operators';
import {
AppState,
loadStages,
searchStages,
addCreatedStaging,
addEditedStaging,
addDeletedStaging,
sendStagingList,
resetStaging,
clearStagingList,
getStages,
getStagesLoaded,
getStagesLoading,
getStagesSearch,
getStagesQueue,
getRateTypes,
getCurveNamesByCurrency,
getTenors,
getPeriodicity,
getAccrualTypes,
getAmortizingTypes,
getAmortizingPeriodicity,
getExistingBeginDates
} from 'src/app/@store';
import {
Stage,
RateType,
Periodicity,
AccrualType,
AmortizingType,
SearchType,
StagingLoanDetailActions,
DictionaryObject
} from 'src/app/common';
import { environment } from 'src/environments/environment';
import { ColDef } from 'ag-grid-community';
import { MaskPipe } from 'ngx-mask';
import { DatePipe, CommonModule, AsyncPipe } from '@angular/common';
@Component({
selector: 'app-staging-loan-details-popup',
templateUrl: './staging-loan-details-popup.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class StagingLoanDetailsPopupComponent implements OnDestroy {
......
stagingLoanDetailQueue$: Observable<any>;
backdropClickCheck$: Observable<unknown>;
isDirty: boolean;
contractReference: string;
instrumentType: string;
queue: { create_list: Stage[]; update_list: Stage[]; delete_list: Stage[] };
......
constructor(
@Inject(MAT_DIALOG_DATA) public dialogData: any,
public dialogRef: MatDialogRef<StagingLoanDetailsPopupComponent>,
private store: Store<AppState>,
private maskPipe: MaskPipe,
private datePipe: DatePipe
) {
......
this.stagingLoanDetailQueue$ = this.store.pipe(
select(getStagesQueue),
tap(queue => (this.queue = queue))
);
this.backdropClickCheck$ = this.dialogRef
.backdropClick()
.pipe(map((event: MouseEvent) => this.checkForClose(event, this.queue, this.isDirty)));
And in the app module that declare this typescript, I have imported the CommonModule in the NgModule section too.
However, it still prompt the error:
Error: src/app/modules/create-simulation/dialogs/staging-loan-details-popup/staging-loan-details-popup.component.html:57:32
- error NG8004: No pipe found with name 'async'. 57 {{ stagingLoanDetailQueue$ | async }} ~~~~~ src/app/modules/create-simulation/dialogs/staging-loan-details-popup/staging-loan-details-popup.component.ts:49:16 49 templateUrl: './staging-loan-details-popup.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component StagingLoanDetailsPopupComponent.
I searched for solution and asked ChatGPT as well but still could not solve this error. Hope anyone can help. Actually, this is just one of the error it prompts. Basically, every async in the html template prompt the same error when build.