Angular MatPaginator not working

前端 未结 30 1617
情歌与酒
情歌与酒 2020-12-04 23:05

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

30条回答
  •  悲哀的现实
    2020-12-04 23:48

    After trying all the above-provided solutions finally the simple solution worked for me. I am posting for reference if anyone stuck.

    I am using Angular 8. Just add { static: false } in child reference

      @ViewChild(MatSort, { static: false }) sort: MatSort;
      @ViewChild(MatPaginator, {static: false}) paginator: MatPaginator;
    

    Got Solution From Here

    I was using this :

    @ViewChild(MatSort, { read: true, static: false }) sort: MatSort;

    @ViewChild(MatPaginator, { read: true, static: false }) paginator: MatPaginator;

提交回复
热议问题