title: mat-paginator breaks when mat-table is inside of NgIf
body: <p>I have an angular project that is using <code>mat-table</code> and <code>mat-paginator</code> for a certain view, the problem is the view has a grid view and table view with a toggle, the grid view is default and table is hidden using an NgIf when the grid view is active.  If I set the default to the table view then pagination works fine unless I swap to grid view and back, if the default if set to grid it breaks when I swap to the table view.  I'm guessing its because the table is hidden when this code runs:</p>
  
  <pre><code>this.sliceList = new MatTableDataSource&lt;Slice&gt;(result);
  this.sliceList.paginator = this.paginator;
  </code></pre>
  
  <p>I tried console logging <code>this.sliceList</code> and <code>sliceList.paginator</code> is undefined when the grid view is defaulted  so I assuming this is the issue.  How Can I fix this?</p>