Angular · Middle · Question 75 of 75

How do you render a list of 10,000 rows without creating 10,000 DOM nodes?

<cdk-virtual-scroll-viewport itemSize="48" class="h-96">
  <div *cdkVirtualFor="let row of rows">{{ row.name }}</div>
</cdk-virtual-scroll-viewport>

Explanation

track helps reuse DOM nodes but doesn't reduce their number. Virtual scrolling keeps the DOM small; pagination is another option.

Further reading

Problem with a question

Angular · Middle · question 75

Test yourself

Take the Angular · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz