Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@if (shouldRun) {
@if (shouldRun()) {
<div class="example-header">Content before</div>
<cdk-virtual-scroll-viewport scrollWindow itemSize="50">
<div *cdkVirtualFor="let item of items" class="example-item">{{item}}</div>
</cdk-virtual-scroll-viewport>
<div class="example-footer">Content after</div>
}

@if (!shouldRun) {
@if (!shouldRun()) {
<div>Please open on StackBlitz to see result</div>
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
import {ChangeDetectionStrategy, Component, input} from '@angular/core';
import {ScrollingModule} from '@angular/cdk/scrolling';

/** @title Virtual scrolling window */
Expand All @@ -11,7 +11,7 @@ import {ScrollingModule} from '@angular/cdk/scrolling';
imports: [ScrollingModule],
})
export class CdkVirtualScrollWindowScrollingExample {
@Input() shouldRun = /(^|.)(stackblitz|webcontainer).(io|com)$/.test(window.location.host);
readonly shouldRun = input(/(^|.)(stackblitz|webcontainer).(io|com)$/.test(window.location.host));

items = Array.from({length: 100000}).map((_, i) => `Item #${i}`);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
AfterContentInit,
Component,
ContentChildren,
Input,
AfterViewInit,
QueryList,
ViewChild,
ContentChild,
forwardRef,
input,
} from '@angular/core';
import {MatSort, MatSortModule} from '@angular/material/sort';
import {
Expand Down Expand Up @@ -94,9 +94,8 @@ export class WrapperTable<T> implements AfterContentInit {

@ViewChild(MatTable, {static: true}) table: MatTable<T>;

@Input() columns: string[];

@Input() dataSource: DataSource<T>;
readonly columns = input.required<string[]>();
readonly dataSource = input.required<DataSource<T>>();

ngAfterContentInit() {
this.columnDefs.forEach(columnDef => this.table.addColumnDef(columnDef));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource()" class="mat-elevation-z8">
<ng-content></ng-content>

<!-- Position Column -->
Expand Down
Loading