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