Skip to content

Commit 6b02256

Browse files
authored
refactor: migrate example inputs to signal inputs (#29789)
This commit was generated using the signal input migration.
1 parent 6beab1c commit 6b02256

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@if (shouldRun) {
1+
@if (shouldRun()) {
22
<div class="example-header">Content before</div>
33
<cdk-virtual-scroll-viewport scrollWindow itemSize="50">
44
<div *cdkVirtualFor="let item of items" class="example-item">{{item}}</div>
55
</cdk-virtual-scroll-viewport>
66
<div class="example-footer">Content after</div>
77
}
88

9-
@if (!shouldRun) {
9+
@if (!shouldRun()) {
1010
<div>Please open on StackBlitz to see result</div>
1111
}

src/components-examples/cdk/scrolling/cdk-virtual-scroll-window-scrolling/cdk-virtual-scroll-window-scrolling-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
1+
import {ChangeDetectionStrategy, Component, input} from '@angular/core';
22
import {ScrollingModule} from '@angular/cdk/scrolling';
33

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

1616
items = Array.from({length: 100000}).map((_, i) => `Item #${i}`);
1717
}

src/components-examples/material/table/table-wrapped/table-wrapped-example.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import {
33
AfterContentInit,
44
Component,
55
ContentChildren,
6-
Input,
76
AfterViewInit,
87
QueryList,
98
ViewChild,
109
ContentChild,
1110
forwardRef,
11+
input,
1212
} from '@angular/core';
1313
import {MatSort, MatSortModule} from '@angular/material/sort';
1414
import {
@@ -94,9 +94,8 @@ export class WrapperTable<T> implements AfterContentInit {
9494

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

97-
@Input() columns: string[];
98-
99-
@Input() dataSource: DataSource<T>;
97+
readonly columns = input.required<string[]>();
98+
readonly dataSource = input.required<DataSource<T>>();
10099

101100
ngAfterContentInit() {
102101
this.columnDefs.forEach(columnDef => this.table.addColumnDef(columnDef));

src/components-examples/material/table/table-wrapped/wrapper-table.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<table mat-table [dataSource]="dataSource" class="mat-elevation-z8">
1+
<table mat-table [dataSource]="dataSource()" class="mat-elevation-z8">
22
<ng-content></ng-content>
33

44
<!-- Position Column -->

0 commit comments

Comments
 (0)