Angular MatPaginator not working

前端 未结 30 1661
情歌与酒
情歌与酒 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-05 00:05

    I had a similar issue to this, with mat-paginator inside a container with a ngIf.

    The only thing that worked for me was the comment:

    Thank you - this was the solution for me. I opted to use [hidden] instead of ngIf so that the paginator would render even if there wasn't any data, but wouldn't show up to the user – TabsNotSpaces

    To clarify, what I did was create a div, outside the container, with [hidden]=.

提交回复
热议问题