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

109
Views
Angular How to combine Interval with Zip to show loading

I have a page which has to be update every minute, but I have several http request. So I'm trying use Interval with zip operator. How Can I combine these two to show my loading "isLoading" after all the request?

This is what I got :

    isLoading = true;
    source = interval(60000);

  ngOnInit(): void {
    const responseZipado = zip(
      this.monitorService.getSMPPstatus(),
      this.homeService.getCampaignsToday(),
      this.monitorService.getPerfomance(),
    );

    
      responseZipado.subscribe((valores) => {
      this.statusSMPP = valores[0],
      this.dataSourceToday = valores[1],
      this.perfomanceDataSource = valores[2],
    });

  }

should I use other operator than Zip?

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

0

You can use forkJoin for parallel http requests because you need value after loading all requests.

Example:

interval(60000).pipe(
  tap(() => this.isLoading = true),
  switchMap(() => forkJoin([
    this.monitorService.getSMPPstatus().pipe(catchError(error => of(error))),
    this.homeService.getCampaignsToday().pipe(catchError(error => of(error))),
    this.monitorService.getPerfomance().pipe(catchError(error => of(error))),
  ])),
).subscribe((valores) => {
  this.isLoading = false;
  this.statusSMPP = valores[0];
  this.dataSourceToday = valores[1];
  this.perfomanceDataSource = valores[2];
})
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!