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

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

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 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