I am fetching the data from the server, the data is coming well and showing in the but the paginator is not working although it is only showing.

The paginator is showing the webpage but it is not working as the next button, go to page etc.

```
<div class="container">
  <div class="row">
    <div class="col my-3">
      <div class="mat-elevation-z8">
        <app-message></app-message>

        <table mat-table [dataSource]="dataSource">

          <!-- Position Column -->
          <ng-container matColumnDef="name">
            <th mat-header-cell *matHeaderCellDef> Name </th>
            <td mat-cell *matCellDef="let element"> {{element.name}}</td>
          </ng-container>

           <!-- Position Column -->
           <ng-container matColumnDef="phone">
            <th mat-header-cell *matHeaderCellDef> Phone </th>
            <td mat-cell *matCellDef="let element"> {{element.phone}}</td>
          </ng-container>

          <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
          <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
        </table>

        <mat-paginator   [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>
      </div>
    </div>
  </div>
</div>

```

This is the TS code.

```
 export class UsersComponent implements OnInit {
  displayedColumns: string[] = ['name', 'phone'];

  dataSource = new MatTableDataSource<PeriodicElement>([]);

  @ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
  constructor(public data: DataService, private rest: RestApiService) {}
   ngOnInit() {
   this.getUsers();
   this.dataSource.paginator = this.paginator;
  }

  async getUsers(){
    try {

      const data =await this.rest.get("http://localhost:3030/user/auth/all/users");
      if(data['status']) {
        console.log(data['data']);

        this.dataSource = data['data'];

      } else {
        this.data.error(data['message']);
      }
    } catch (error) {
      this.data.error(error['message']);
    }
  }

}

interface PeriodicElement {
  slno:number,
  name: string,
  phone: string
}

const dataArray: PeriodicElement[] = [];

```