更新时间:2023-12-01 13:59:46
您可以在将数据设置为dataSource之前对其进行更改. 例如,如果您可以观察到一些http数据,则可以执行以下操作:
You could make changes in data before setting it to dataSource. For example, if you get some http data as observable, you could do:
this.data$ = this.certificateService.certificates$.pipe(
map(data => {
data.column5 = data.column4 // and make all other calculations
return data;
})
);
然后您可以订阅数据并将其设置在数据源中
Then you could subscribe on data and set it in datasource
this.data$.subscribe(data => {
this.dataSource = new MatTableDataSource(data)
})