Note that paging/sort not work correctly. Paging does not show the number of elements it is showing and sorting does not work, but if you delete the line in the html file *ngIf="dataSource?.filteredData.length > 0" the error is fixed. If you use filtering, it works, but it does not show the filter amount
Check the example.
https://stackblitz.com/edit/angular-wqkekh-nm3pn2?file=app/table-pagination-example.html
This can be solved by the following strategy:
dataSource = new MatTableDataSource();
@ViewChild(MatSort, {static: false}) set content(sort: MatSort) {
this.dataSource.sort = sort;
}
Now even if you use *ngIf, it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With