Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda