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

139
Visualizações
How can i insert my big data in html on chunks?

I am making a http call where the response is coming fast from the API. It is a big data so when i try to insert that on my HTML by browser freezes

 ngOnInit() {
    const params = {
      page: 1,
      size: 100000
    }
    this.testSer.getPassengers(params).subscribe(
      (data: any) => {
        this.data = data.data;
      })
  }
<ul *ngFor="let item of data; let i = index">
  {{ i}} -- {{ item.name }}
</ul>

How can i 'give work' on chunks to browser ?

what i tried

In past somewhere i saw a code similuar to this

ngOnInit() {
    const params = {
      page: 1,
      size: 100000
    }
    this.testSer.getPassengers(params).subscribe(
      (data: any) => {
        this.data = data.data;
        this.timeoutInterval = setTimeout(() => {
          this.loopChunks();
        }, 150);
      })
  }

  loopChunks() {
    if (this.currentChunk < this.data.length) {
      this.currentChunk += this.chunkStep;
      this.timeoutInterval = setTimeout(() => {
        this.loopChunks();
      }, 1000);
    }
  }

where he used setTimeout for that but i can't make that work

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I'd argue that rendering the DOM elements itself is what freezes your browser.

You may want to add virtual scroll to your table so that you only display what's currently visible in the screen instead of everything at once.

There are many libraries that can help you with that, like Clusterize or ngx-virtual-scroller.

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