Virtual scrolling for large lists
📖 Scenario: You are building a web app that shows a long list of user names. To keep the app fast and smooth, you want to show only the visible part of the list at a time. This technique is called virtual scrolling.
🎯 Goal: Create an Angular standalone component that uses virtual scrolling to display a list of 1000 user names efficiently.
📋 What You'll Learn
Create a list of 1000 user names as strings
Set a page size variable to control how many items show at once
Use Angular's
cdk-virtual-scroll-viewport to render the list with virtual scrollingDisplay each user name inside the virtual scroll viewport
💡 Why This Matters
🌍 Real World
Virtual scrolling is used in apps that show long lists like contacts, messages, or product catalogs to keep the app fast and responsive.
💼 Career
Knowing how to implement virtual scrolling is important for frontend developers to optimize performance and user experience in real-world Angular applications.
Progress0 / 4 steps