diff --git a/src/lib/table/table.spec.ts b/src/lib/table/table.spec.ts index 9d11c4253ac1..bac5eee59ae3 100644 --- a/src/lib/table/table.spec.ts +++ b/src/lib/table/table.spec.ts @@ -565,7 +565,7 @@ class MatTableApp { columnsToRender = ['column_a', 'column_b', 'column_c']; isFourthRow = (i: number, _rowData: TestData) => i == 3; - @ViewChild(MatTable) table: MatTable; + @ViewChild(MatTable, {static: true}) table: MatTable; } @Component({ @@ -595,7 +595,7 @@ class NativeHtmlTableApp { dataSource: FakeDataSource | null = new FakeDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(MatTable) table: MatTable; + @ViewChild(MatTable, {static: true}) table: MatTable; } @Component({ @@ -615,7 +615,7 @@ class StickyTableApp { dataSource = new FakeDataSource(); columnsToRender = ['column_a']; - @ViewChild(MatTable) table: MatTable; + @ViewChild(MatTable, {static: true}) table: MatTable; } @@ -682,9 +682,9 @@ class ArrayDataSourceMatTableApp implements AfterViewInit { dataSource = new MatTableDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(MatTable) table: MatTable; - @ViewChild(MatPaginator) paginator: MatPaginator; - @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatTable, {static: true}) table: MatTable; + @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; + @ViewChild(MatSort, {static: true}) sort: MatSort; @ViewChild(MatSortHeader) sortHeader: MatSortHeader; constructor() { @@ -735,8 +735,8 @@ class MatTableWithSortApp implements OnInit { dataSource = new MatTableDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(MatTable) table: MatTable; - @ViewChild(MatSort) sort: MatSort; + @ViewChild(MatTable, {static: true}) table: MatTable; + @ViewChild(MatSort, {static: true}) sort: MatSort; constructor() { this.underlyingDataSource.data = []; @@ -786,8 +786,8 @@ class MatTableWithPaginatorApp implements OnInit { dataSource = new MatTableDataSource(); columnsToRender = ['column_a', 'column_b', 'column_c']; - @ViewChild(MatTable) table: MatTable; - @ViewChild(MatPaginator) paginator: MatPaginator; + @ViewChild(MatTable, {static: true}) table: MatTable; + @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator; constructor() { this.underlyingDataSource.data = [];