mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Joey Perrott
parent
70aee92706
commit
a0113639bc
+4
-4
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user