[英]Argument of type 'unknown[]' is not assignable to parameter of type > 'OperatorFunction
[英]Argument of type 'MatTableDataSource<EmpElement>' is not assignable to parameter of type 'Collection<unknown>'.
如果我将 ngx-paginator 添加到 mat table,我将面临这个问题。 请帮帮我。
<table mat-table [dataSource]="dataSource| paginate: {itemsPerPage: size, currentPage: p,
totalItems: EMP_DATA.length}" class="mat-elevation-z8" matSort>
.
.
<pagination-controls (pageChange)="p = $event;paginate(p)"
[responsive]="true"
></pagination-controls>
在 ts 文件中
size = 10;
pageIndex = 0;
p=1;
dataSource = new MatTableDataSource<EmpElement>(this.EMP_DATA);
paginate(event: any) {
this.pageIndex=event;
}
从错误中,我假设 EmpElement 不是数组
更改以下行:
dataSource = new MatTableDataSource<EmpElement[]>(this.EMP_DATA);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.