각도 CLI 재질 테이블 매김을 사용하고 있습니다. 어떤 이유로 든 작동하지 않습니다. ngAfterViewInit 내부에 메시지를 기록하고 경고를 볼 수있었습니다.각도 재질 테이블 번호 매기기
HTML
<mat-table #table [dataSource]="dataSource">
<ng-container matColumnDef="Comment">
<mat-header-cell *matHeaderCellDef> Commment </mat-header-cell>
<mat-cell *matCellDef="let row"> {{row.Comment}} </mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns" ></mat-header-row>
<mat-row *matRowDef="let row; columns:displayedColumns"></mat-row>
</mat-table>
<mat-paginator #paginator
[pageSize]="10"
[pageSizeOptions]="[5, 10, 20]">
</mat-paginator>
component.ts
import { Component, OnInit, Input, Output,NgModule,ViewChild } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { DataSource } from '@angular/cdk/collections';
import { MatTableDataSource, MatPaginator } from '@angular/material';
@Component({
selector: 'dashboard',
moduleId: module.id,
templateUrl: 'dashboard.component.html'
})
export class DashboardComponent implements OnInit {
dataSource = new MatTableDataSource();
@ViewChild(MatPaginator) paginator: MatPaginator;
displayedColumns = ['Comment'];
ngOnInit(): void {
this.GetToDoList(this.userID);
}
GetToDoList(PNSLUID: string) {
this._dashboardService.getToDoList(PNSLUID)
.subscribe(
data => {
// this.toDoList = data.result;
this.dataSource = new MatTableDataSource(data.result);
},
error => console.log('GetControls Method: ' + <any>error, 'alert alert-danger'));
}
ngAfterViewInit() {
this.dataSource.paginator = this.paginator;
}
내가 hammer.js 및 웹 animations.min.js 각도-cli.json를 넣어 각도 CLI를 사용하고 있기 때문에
angular-cli.json
"scripts": [
"scripts/jquery-1.10.2.min.js",
"scripts/jquery-migrate-1.2.1.min.js",
"scripts/jquery-ui.js",
"scripts/bootstrap.min.js",
"scripts/hammer.js",
"scripts/web-animations.min.js"
],
고맙습니다. – rgoal