title: Angular material table not showing data until I click paging links
body: <p>I followed <a href="https://stackblitz.com/angular/rxrqyyyjrrg?file=main.ts" rel="nofollow noreferrer">stackblitz MatDataTable</a>. The table is not populating until i click pagination links. After clicking pagination everything works normal.I am trying since last day. I tried <a href="https://stackoverflow.com/a/50230116/987076">this stackoverflow</a> solution as well but didn't workde: </p>
  
  <p><strong><em>table.component.ts</em></strong></p>
  
  <pre><code>import { Component, OnInit, ViewChild } from '@angular/core';
  import { MatPaginator, MatTableDataSource } from '@angular/material';
  
  
  @Component({
    selector: 'app-table',
    templateUrl: './table.component.html',
    styleUrls: ['./table.component.scss']
  })
  export class TableComponent implements OnInit {
    displayedColumns: string[] = ['position', 'name', 'weight', 'symbol'];
    dataSource = new MatTableDataSource&lt;PeriodicElement&gt;(ELEMENT_DATA);
  
    @ViewChild(MatPaginator) paginator: MatPaginator;      
  
    ngOnInit() {
      this.dataSource.paginator = this.paginator;
    }
  }
  
  export interface PeriodicElement {
    name: string;
    position: number;
    weight: number;
    symbol: string;
  }
  
  const ELEMENT_DATA: PeriodicElement[] = [
    {position: 1, name: 'Hydrogen', weight: 1.0079, symbol: 'H'},
    {position: 2, name: 'Helium', weight: 4.0026, symbol: 'He'},
    {position: 3, name: 'Lithium', weight: 6.941, symbol: 'Li'},
    {position: 4, name: 'Beryllium', weight: 9.0122, symbol: 'Be'},
    {position: 5, name: 'Boron', weight: 10.811, symbol: 'B'},
    {position: 6, name: 'Carbon', weight: 12.0107, symbol: 'C'},
    {position: 7, name: 'Nitrogen', weight: 14.0067, symbol: 'N'},
    {position: 8, name: 'Oxygen', weight: 15.9994, symbol: 'O'}
  ];
  </code></pre>
  
  <p><strong><em>table.component.html</em></strong></p>
  
  <p>Copied same data from <a href="https://stackblitz.com/angular/rxrqyyyjrrg?file=app%2Ftable-pagination-example.html" rel="nofollow noreferrer">here</a>. and removed the table, tr, th and td tags. as per google suggestion.</p>
  
  <pre><code>&lt;div class="mat-elevation-z8"&gt;
    &lt;mat-table [dataSource]="dataSource"&gt;
  
      &lt;!-- Position Column --&gt;
      &lt;ng-container matColumnDef="position"&gt;
        &lt;mat-header-cell *matHeaderCellDef&gt; No. &lt;/mat-header-cell&gt;
        &lt;mat-cell *matCellDef="let element"&gt; {{element.position}} &lt;/mat-cell&gt;
      &lt;/ng-container&gt;
  
      &lt;!-- Name Column --&gt;
      &lt;ng-container matColumnDef="name"&gt;
        &lt;mat-header-cell *matHeaderCellDef&gt; Name &lt;/mat-header-cell&gt;
        &lt;mat-cell *matCellDef="let element"&gt; {{element.name}} &lt;/mat-cell&gt;
      &lt;/ng-container&gt;
  
      &lt;!-- Weight Column --&gt;
      &lt;ng-container matColumnDef="weight"&gt;
        &lt;mat-header-cell *matHeaderCellDef&gt; Weight &lt;/mat-header-cell&gt;
        &lt;mat-cell *matCellDef="let element"&gt; {{element.weight}} &lt;/mat-cell&gt;
      &lt;/ng-container&gt;
  
      &lt;!-- Symbol Column --&gt;
      &lt;ng-container matColumnDef="symbol"&gt;
        &lt;mat-header-cell *matHeaderCellDef&gt; Symbol &lt;/mat-header-cell&gt;
        &lt;mat-cell *matCellDef="let element"&gt; {{element.symbol}} &lt;/mat-cell&gt;
      &lt;/ng-container&gt;
  
      &lt;mat-header-row *matHeaderRowDef="displayedColumns"&gt;&lt;/mat-header-row&gt;
      &lt;mat-row *matRowDef="let row; columns: displayedColumns;"&gt;&lt;/mat-row&gt;
    &lt;/mat-table&gt;
  
    &lt;mat-paginator [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons&gt;&lt;/mat-paginator&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><em>Package.json consists:</em></p>
  
  <pre><code>"@agm/core": "1.0.0-beta.2",
  "@angular/animations": "5.2.9",
  "@angular/cdk": "5.2.4",
  "@angular/common": "5.2.9",
  "@angular/compiler": "5.2.9",
  "@angular/core": "5.2.9",
  "@angular/flex-layout": "5.0.0-beta.13",
  "@angular/forms": "5.2.9",
  "@angular/http": "5.2.9",
  "@angular/material": "5.2.4",
  "@angular/cli": "1.7.3",
  </code></pre>