Imagine you are building an application that needs to display 10,000 employees, 50,000 products, or even 100,000 records.
You fetch all the records from an API and display them using Angular's *ngFor .
Everything works fine when you have 20 or 50 records.
But what happens when you have 50,000 records?
Your browser suddenly has to create thousands of HTML elements, manage them, calculate their positions, apply styles, and keep track of changes.
The result?
Slow initial rendering.
Increased memory consumption.
More DOM elements.
Poor scrolling performance.
A bad user experience, especially on low-end devices.
So, how can we solve this problem?
One solution is Angular Virtual Scrolling .
In this article, we will understand virtual scrolling from the very beginning, explore how it works internally, and implement it in a real Angular application.
Let's get started!
1.β¦