Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

107
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda