Using Angular 7 I added material table to my application with ng generate @angular/material:table test-table
Inside the generated template there is a paginator:
<mat-paginator #paginator
[length]="dataSource.data.length"
[pageIndex]="0"
[pageSize]="50"
[pageSizeOptions]="[25, 50, 100, 250]">
</mat-paginator>
On init the datasource is changed:
ngOnInit() {
this.dataSource = new ItemsTableDataSource(
this.paginator,
this.sort,
this.route.paramMap,
this.afs
);
}
When trying to compile the component on Karma expect(component).toBeTruthy();
I'm getting the following error
Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has
changed after it was checked. Previous value: 'length: 0'. Current
value: 'length: 1'.
How can I solve this issue?