Skip to content

Commit 1d38de0

Browse files
author
Your Name
committed
Angular Material In Depth
1 parent 1009e24 commit 1d38de0

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/app/virtual-scrolling/virtual-scrolling.component.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,25 @@
55

66
<h3>Virtual Scrolling Demo</h3>
77

8-
<mat-list class="scrolling-container mat-elevation-z7">
9-
<mat-list-item *ngFor="let item of items"> {{item}} </mat-list-item>
8+
<mat-list class="mat-elevation-z7">
9+
10+
<cdk-virtual-scroll-viewport itemSize="48" class="scrolling-container">
11+
12+
<mat-list-item *cdkVirtualFor="let item of items; let index = index;
13+
let count = count;
14+
let first = first;
15+
let last = last;
16+
let even = even;
17+
let odd = odd;">
18+
19+
{{item}}
20+
21+
</mat-list-item>
22+
23+
24+
</cdk-virtual-scroll-viewport>
25+
26+
1027
</mat-list>
1128

1229
</div>

src/app/virtual-scrolling/virtual-scrolling.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Component, OnInit} from '@angular/core';
88
})
99
export class VirtualScrollingComponent implements OnInit {
1010

11-
items = Array.from({length: 20000}).map((value, i) => `Item #${i}`);
11+
items = Array.from({length: 100000}).map((value, i) => `Item #${i}`);
1212

1313
ngOnInit() {
1414

0 commit comments

Comments
 (0)