File tree Expand file tree Collapse file tree 5 files changed +56
-1
lines changed
Expand file tree Collapse file tree 5 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import {CourseResolver} from "./services/course.resolver";
77import { CreateCourseComponent } from './create-course/create-course.component' ;
88import { DragDropComponent } from './drag-drop/drag-drop.component' ;
99import { TreeDemoComponent } from './tree-demo/tree-demo.component' ;
10+ import { VirtualScrollingComponent } from './virtual-scrolling/virtual-scrolling.component' ;
1011
1112const routes : Routes = [
1213 {
@@ -36,6 +37,10 @@ const routes: Routes = [
3637 {
3738 path : "tree-demo" ,
3839 component : TreeDemoComponent
40+ } ,
41+ {
42+ path : 'virtual-scrolling' ,
43+ component : VirtualScrollingComponent
3944 } ,
4045 {
4146 path : "**" ,
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import {DragDropComponent} from './drag-drop/drag-drop.component';
4545import { MatGridListModule } from '@angular/material/grid-list' ;
4646import { TreeDemoComponent } from './tree-demo/tree-demo.component' ;
4747import { MatTreeModule } from '@angular/material/tree' ;
48+ import { VirtualScrollingComponent } from './virtual-scrolling/virtual-scrolling.component' ;
4849
4950@NgModule ( {
5051 declarations : [
@@ -58,7 +59,8 @@ import {MatTreeModule} from '@angular/material/tree';
5859 CreateCourseStep1Component ,
5960 CreateCourseStep2Component ,
6061 DragDropComponent ,
61- TreeDemoComponent
62+ TreeDemoComponent ,
63+ VirtualScrollingComponent
6264 ] ,
6365 imports : [
6466 BrowserModule ,
Original file line number Diff line number Diff line change 1+
2+ < div class ="container ">
3+
4+ < div class ="virtual-scrolling ">
5+
6+ < h3 > Virtual Scrolling Demo</ h3 >
7+
8+ < mat-list class ="scrolling-container mat-elevation-z7 ">
9+ < mat-list-item *ngFor ="let item of items "> {{item}} </ mat-list-item >
10+ </ mat-list >
11+
12+ </ div >
13+
14+ </ div >
15+
Original file line number Diff line number Diff line change 1+
2+ .container {
3+ font-family : " Roboto" ;
4+ display : flex ;
5+ justify-content : center ;
6+ padding : 30px ;
7+ }
8+
9+
10+ .scrolling-container {
11+ display : block ;
12+ width : 200px ;
13+ max-height : 200px ;
14+ overflow-y : scroll ;
15+ }
Original file line number Diff line number Diff line change 1+ import { Component , OnInit } from '@angular/core' ;
2+
3+
4+ @Component ( {
5+ selector : "virtual-scrolling" ,
6+ templateUrl : 'virtual-scrolling.component.html' ,
7+ styleUrls : [ "virtual-scrolling.component.scss" ]
8+ } )
9+ export class VirtualScrollingComponent implements OnInit {
10+
11+ items = Array . from ( { length : 100 } ) . map ( ( value , i ) => `Item #${ i } ` ) ;
12+
13+ ngOnInit ( ) {
14+
15+ }
16+
17+
18+ }
You can’t perform that action at this time.
0 commit comments