Skip to content

Commit

Permalink
fix(material): fix table generator schematic (#16204)
Browse files Browse the repository at this point in the history
Import `MatTable` (used in `ViewChild` query).
Add `static` option to view queries for future support of Angular
version 9.
  • Loading branch information
LayZeeDK authored and josephperrott committed Jun 6, 2019
1 parent 70aee92 commit a011363
Showing 1 changed file with 4 additions and 4 deletions.
@@ -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({
Expand All @@ -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. */
Expand Down

0 comments on commit a011363

Please sign in to comment.