Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

77
Views
Combine 3 asincrónicos con un observable

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!