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

116
Views
¿Cómo puedo esperar a que finalice el código o la suscripción antes de que vuelva la función?

Necesito esperar a que finalice la suscripción 2 en mi función antes de que devuelva el valor de 'this.getRows('employee')' . ¿Cuál sería la mejor manera de hacer eso? Tal vez rxjs ayudaría, pero soy malo con eso. Gracias de antemano

 getEmployeesTable(): Table { this.backendService.getEmployeeSummaryTable().subscribe((employees) => { this.emloyeeSummary = employees; }); this.backendService.getEmployeesTable().subscribe((employees) => { this.emloyees = employees; }); setTimeout(() => (table = this.getRows('employee')), 1000); // this does not help return this.getRows('employee'); // this should only return after the 2 functions above //finished }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

forkJoin esperará a que se completen dos operaciones asíncronas

 getEmployeesTable():Observable<Table>{ return forkJoin({ emloyeeSummary: this.backendService.getEmployeeSummaryTable(), employees: this.backendService.getEmployeesTable() }).pipe( tap((res) => { this.emloyeeSummary = res.emloyeeSummary; this.emloyees = res.employees; }), map(() => this.getRows('employee')) ); }
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!