I have 2 components. Both have mat-table and paginators and pagination is working for one component and not working for the other component though the code is similar. Below
Although selected answer works and solves the problem it is still a workaround. This is proper and more elegant way to deal with the problem.
Try adding AfterViewInit interface to your class, then put this.dataSource.paginator = this.paginator inside ngAfterViewInit() method
ngAfterViewInit() {
this.dataSource.paginator = this.paginator
}
then you would not have to call workaround setTimeout.