Tengo 3 observables que uso para filtrar la parte html.
Aquí está la parte mecanografiada
fiscalYear$ = this.store$.select(this.tableStoreService.getFiscalYear); isLoading$ = this.store$.select(this.tableStoreService.tableSelectors.getLoading); isReportLoading$ = this.store$.select(isReportLoading); Todos estos valores tienen Observable<boolean> en el tipo de retorno.
Luego lo uso así para filtrar html en [disabled]
<button class="btn btn-primary font-weight-700 font-size-200" [disabled]="(isReportLoading$ | async) || (fiscalYear$ | async) < 2022 || (isLoading$ | async) " (click)="clickExport()"> {{ 'homepage.export' | translate }} <mat-icon class="btn-icon export-icon" svgIcon="export"></mat-icon> </button>trato de hacerlo asi
get isExportAvialable$() { return combineLatest(this.fiscalYear$, this.isLoading$, this.isReportLoading$, (fiscalYear, isLoading, isReportLoading) => isReportLoading || fiscalYear < 2022 || isLoading); } Pero fiscalYear < 2022 muestra un error
¿Cómo puedo combinarlo para usar solo uno con async?
Puedes resolverlo así:
fiscalYear$ = this.store$.select(this.tableStoreService.getFiscalYear); isLoading$ = this.store$.select(this.tableStoreService.tableSelectors.getLoading); isReportLoading$ = this.store$.select(isReportLoading); isExportAvailable$ = combineLatest([ this.fiscalYear$, this.isLoading$, this.isReportLoading$ ]).pipe(map(([year, isLoading, isReportLoading]) => return year < 2022 && isLoading && isReportLoading));y luego simplemente use isExportAvailable$ con la canalización asíncrona en su plantilla.