diff --git a/src/lib/table/table.spec.ts b/src/lib/table/table.spec.ts index b6fd1ebbf6bb..97e2d0ffe61a 100644 --- a/src/lib/table/table.spec.ts +++ b/src/lib/table/table.spec.ts @@ -538,7 +538,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({ @@ -568,7 +568,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({ @@ -588,7 +588,7 @@ class StickyTableApp { dataSource = new FakeDataSource(); columnsToRender = ['column_a']; - @ViewChild(MatTable) table: MatTable; + @ViewChild(MatTable, {static: true}) table: MatTable; } @@ -655,9 +655,9 @@ class ArrayDataSourceMatTableApp implements OnInit { 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() { @@ -708,8 +708,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 = []; @@ -759,8 +759,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 = [];