fix(material): fix table generator schematic (#16204)

Import `MatTable` (used in `ViewChild` query).
Add `static` option to view queries for future support of Angular
version 9.
This commit is contained in:
Lars Gyrup Brink Nielsen
2019-06-06 17:42:49 +02:00
committed by Joey Perrott
parent 70aee92706
commit a0113639bc
@@ -1,5 +1,5 @@
import { AfterViewInit, Component, OnInit, ViewChild<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core';
import { MatPaginator, MatSort } from '@angular/material';
import { MatPaginator, MatSort, MatTable } from '@angular/material';
import { <%= classify(name) %>DataSource, <%= classify(name) %>Item } from './<%= dasherize(name) %>-datasource';
@Component({
@@ -16,9 +16,9 @@ import { <%= classify(name) %>DataSource, <%= classify(name) %>Item } from './<%
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %>
})
export class <%= classify(name) %>Component implements AfterViewInit, OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@ViewChild(MatTable) table: MatTable<<%= classify(name) %>Item>;
@ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
@ViewChild(MatSort, {static: false}) sort: MatSort;
@ViewChild(MatTable, {static: false}) table: MatTable<<%= classify(name) %>Item>;
dataSource: <%= classify(name) %>DataSource;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */