title: angular2 material table hide column
body: <p>I have the following angular2 material table</p>
  
  <pre><code>&lt;mat-table #table [dataSource]="dataSource" &gt;
  
          &lt;!--- Note that these columns can be defined in any order.
                The actual rendered columns are set as a property on the row definition" --&gt;
  
          &lt;!-- Position Column --&gt;
          &lt;ng-container matColumnDef="selected"&gt;
              &lt;mat-header-cell *matHeaderCellDef&gt;
                  &lt;mat-checkbox [(ngModel)]="selectAll"&gt;&lt;/mat-checkbox&gt;
              &lt;/mat-header-cell&gt;
              &lt;mat-cell *matCellDef="let element"&gt;
                  &lt;mat-checkbox [(ngModel)]="element.selected" [checked]="selectAll"&gt;&lt;/mat-checkbox&gt;
              &lt;/mat-cell&gt;
          &lt;/ng-container&gt;
  
          &lt;ng-container matColumnDef="id"&gt;
              &lt;mat-header-cell *matHeaderCellDef&gt; Id&lt;/mat-header-cell&gt;
              &lt;mat-cell *matCellDef="let element"&gt; {{element.id}}&lt;/mat-cell&gt;
          &lt;/ng-container&gt;
  
          &lt;ng-container matColumnDef="requested_status"&gt;
              &lt;mat-header-cell *matHeaderCellDef&gt; Status&lt;/mat-header-cell&gt;
              &lt;mat-cell *matCellDef="let element"&gt; {{element.requested_status}}&lt;/mat-cell&gt;
          &lt;/ng-container&gt;
          ......
  </code></pre>
  
  <p>I need to hide a column in the table by some boolean condition. <strong>Is it possible without changing columns map in my component?</strong></p>
  
  <pre><code>displayedColumns = ['selected', 'id', ...];
  </code></pre>
  
  <p>I tried to use <code>*ngIf</code> but it doesn't work. How to do that?</p>