1
votes

I am developing a sample code to use pagination . For this , i am using Angular Material Table . I have managed to show the data inside the table as well as the controls for pagination , but somehow it is not working as it should be.

Below is the stackblitz repo link :

https://stackblitz.com/edit/angular-ivy-i4lmdx?file=src/Service/app.service.ts

Important : It is showing the following error on my VSCode.

Error in Code

Error in Terminal

Any solution please ?

1

1 Answers

2
votes

There are a lot of mistakes in the stackblitz you linked, to name a few:

  • No imports for the angular material components you are using
  • Not calling the correct component
  • Not specifying the correct data source in the mat-table

the error you are seeing

Property 'paginator' does not exist on type 'any[]'.

happens because you are trying to assign an object (paginator) into an array (dummyDataArray), you should instead be setting the paginator on the MatTableDataSource object (in your case - dataSource)

Here is a working stackblitz