I have this code with pagination inside, but the pagination does not work. It always shows all elements. But removing *ngIf from container div, it just woks. Why it is so? How to make it work with *ngIf? I really need to use it.
<div *ngIf="savingTransactionsDataSource" class="mat-elevation-z8">
<table mat-table [dataSource]="savingTransactionsDataSource">
<ng-container [matColumnDef]="column" *ngFor="let column of items">
...
</ng-container>
<tr mat-header-row *matHeaderRowDef="savingColumnsToDisplay; sticky: true;"></tr>
<tr mat-row *matRowDef="let row; columns: savingColumnsToDisplay;"></tr>
</table>
<mat-toolbar class="mat-toolbar-sticky">
<mat-toolbar-row>
<span class="spacer"></span>
<mat-paginator [length]="savingTransactionsDataSource.data.length"
[pageSize]="5"
[pageSizeOptions]="[5, 10, 15, 20]"
showFirstLastButtons>
</mat-paginator>
</mat-toolbar-row>
</mat-toolbar>
</div>