I started with the exact example \"Data table with sorting, pagination, and filtering.\" here https://material.angular.io/components/table/examples It works fine. But
You probably already managed to work around that issue but, since I was looking for that, and probably others will too.
I was facing the same problem, and manage to do it simply by doing the connect
in on ngOnInit
and using another observable in the view (I only put the thing i changed):
export class TableOverviewExample implements OnInit {
obs: Observable<any>;
...
ngOnInit(): void {
...
this.obs = this.dataSource.connect();
}
}
and in the View:
<div *ngFor="let row of obs | async" >
You will probably have to manually disconect the datasource, I have not validated that... I just did in:
ngOnDestroy(): void {
if (this.dataSource) { this.dataSource.disconnect(); }
}