I would like to use the Angular mat-table with mat-paginator controlling the page changes with http request. So, I receive from my server an object with the following attributes:
content: (10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
first: true
last: false
number: 0
numberOfElements: 10
pageable: {sort: {…}, offset: 0, pageSize: 10, pageNumber: 0, paged: true, …}
size: 10
sort: {sorted: false, unsorted: true}
totalElements: 82
totalPages: 9
__proto__: Object
the attribute "number" is the number of the current page and "totalPages" the total of pages that I have.
I've tried to implement the mat-paginator like this:
<mat-paginator [length]="paginas" [pageSize]="10"></mat-paginator>
the variable "paginas" stores the atrribute "totalPages", and is showing correctly:
The problem is, as you can see, the arrows button preview and forward are disabled. I know that I have to do more implementation, but the official documentation of Angular Material doesn't show how to do it.