title: Multiple Mat-Paginator in a single page (Angular 5 Data Table)
body: <p>I have two Angular Data Tables in a single page. I am fetching the data from a Web Server (Async). 
  I have created a an independent component for this.
  My first table is correctly displayed and binded to the sort and paginator but the second one doesn't work. Although it shows the data but the paginator and sort does not work on the second table. Any thoughts what could be the issue?</p>
  
  <p>My Component TS File:</p>
  
  <pre><code>displayedColumns = ['customerId', 'projectId'];
  @Input() dataSource2 = new MatTableDataSource&lt;ScheduledTest&gt;();
  private paginator: MatPaginator;
  private sort: MatSort;
  
  @ViewChild(MatPaginator) set matPaginator(mp: MatPaginator) {
  this.paginator = mp;
  this.dataSource2.paginator = this.paginator;
  }
  
  @ViewChild(MatSort) set matSort(mp: MatSort) {
  this.sort = mp;
  this.dataSource2.sort = this.sort;
  }
  
  ngOnInit() {
  this.getAllCurrentTestCases();
  }
  
  getAllCurrentTestCases() {
  this.isError = false;
  this.isLoading = true;
  this.httpService.getAllCurrentTestCases(this.userService.accountNumber, this.userService.authToken)
    .then((data: AutomatedTest[]) =&gt; {
      this.isLoading = false;
      this.dataSource2 = new MatTableDataSource&lt;AutomatedTest&gt;(data);
      this.dataSource.sort = this.sort;
    })
    .catch(error =&gt; {
      this.isError = true;
    });
  }
  </code></pre>
  
  <p>Component HTML:</p>
  
  <pre><code>&lt;mat-table #table [dataSource]="dataSource2" matSort&gt;
  
  &lt;ng-container matColumnDef="customerId"&gt;
    &lt;mat-header-cell *matHeaderCellDef mat-sort-header&gt;
      &lt;b&gt; Customer ID &lt;/b&gt;
    &lt;/mat-header-cell&gt;
    &lt;mat-cell *matCellDef="let element"&gt; {{element.data.customerId | uppercase }} &lt;/mat-cell&gt;
  &lt;/ng-container&gt;
  
  &lt;ng-container matColumnDef="projectId"&gt;
    &lt;mat-header-cell *matHeaderCellDef mat-sort-header&gt;
      &lt;b&gt; Project ID &lt;/b&gt;
    &lt;/mat-header-cell&gt;
    &lt;mat-cell *matCellDef="let element"&gt; {{element.data.projectId | uppercase}} &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;" matRipple class="element-row" [cdkDetailRow]="row" [cdkDetailRowTpl]="tpl"
    (toggleChange)="onToggleChange($event)"&gt;&lt;/mat-row&gt;
  &lt;!-- &lt;mat-row *matRowDef="let row; columns: ['expandedDetail']; when: isExpansionDetailRow" [@detailExpand]="row.element == expandedElement ? 'expanded' : 'collapsed'"
      style="overflow: hidden"&gt;
    &lt;/mat-row&gt; --&gt;
  </code></pre>
  
  <p>
    
    </p>
  
  <p>My Rendering Page </p>
  
  <pre><code>&lt;app-table-com&gt;&lt;/app-table-com&gt;
  &lt;app-table-com&gt;&lt;/app-table-com&gt;
  </code></pre>