import { AfterViewInit, Component, ViewChild<% if(!!viewEncapsulation) { %>, ViewEncapsulation<% }%><% if(changeDetection !== 'Default') { %>, ChangeDetectionStrategy<% }%> } from '@angular/core'; import { <% if(standalone) { %>MatTableModule, <% } %>MatTable } from '@angular/material/table'; import { <% if(standalone) { %>MatPaginatorModule, <% } %>MatPaginator } from '@angular/material/paginator'; import { <% if(standalone) { %>MatSortModule, <% } %>MatSort } from '@angular/material/sort'; import { <%= classify(name) %>DataSource, <%= classify(name) %>Item } from './<%= dasherize(name) %>-datasource'; @Component({ selector: '<%= selector %>',<% if(inlineTemplate) { %> template: ` <%= indentTextContent(resolvedFiles.template, 4) %> `,<% } else { %> templateUrl: './<%= dasherize(name) %>.component.html',<% } if(inlineStyle) { %> styles: ` <%= indentTextContent(resolvedFiles.stylesheet, 4) %> `<% } else { %> styleUrl: './<%= dasherize(name) %>.component.<%= style %>'<% } %><% if(!!viewEncapsulation) { %>, encapsulation: ViewEncapsulation.<%= viewEncapsulation %><% } if (changeDetection !== 'Default') { %>, changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %><% if(standalone) { %>, imports: [MatTableModule, MatPaginatorModule, MatSortModule]<% } else { %>, standalone: false<% } %> }) export class <%= classify(name) %>Component implements AfterViewInit { @ViewChild(MatPaginator) paginator!: MatPaginator; @ViewChild(MatSort) sort!: MatSort; @ViewChild(MatTable) table!: MatTable<<%= classify(name) %>Item>; dataSource = new <%= classify(name) %>DataSource(); /** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */ displayedColumns = ['id', 'name']; ngAfterViewInit(): void { this.dataSource.sort = this.sort; this.dataSource.paginator = this.paginator; this.table.dataSource = this.dataSource; } }