title: Angular 2 enum with ngClass
body: <p>Hello I am trying to use a conditional class with an enum. I have used enums in html before with <code>ngSwitchCase</code> and have the same error that I'm getting now. When I would add a property called that enum and assign it to that enum it would work.</p>
  
  <p><strong>working example:</strong></p>
  
  <pre><code>                    &lt;ng-container *ngFor="let column of columns" [ngSwitch]="column.dataType"&gt;
                      &lt;td *ngSwitchCase="DataType.Text"&gt;{{getPropertyValue(row,column.propertyName)}}&lt;/td&gt;
                      &lt;td *ngSwitchCase="DataType.Date"&gt;date&lt;/td&gt;
                      &lt;td *ngSwitchCase="DataType.Number"&gt;number&lt;/td&gt;
                      &lt;td *ngSwitchDefault&gt;default&lt;/td&gt;
                  &lt;/ng-container&gt;
  </code></pre>
  
  <p><strong>ts</strong></p>
  
  <pre><code>private DataType = DataType;
  </code></pre>
  
  <p><strong>not working:</strong></p>
  
  <pre><code>            &lt;span *ngClass="(column.sortType === SortType.Ascending)? 'privilege-grid-sortasc': (column.sortType === SortType.Descending)?'privilege-grid-sortdesc':'privilege-grid-sortnone'"&gt;&lt;/span&gt; 
  </code></pre>
  
  <p>I also have tried <code>[ngClass] ="{'class-name': var === enum,...}"</code></p>
  
  <p><strong>ts</strong></p>
  
  <pre><code>   private SortType = SortType;
  </code></pre>
  
  <p><strong>error message:</strong></p>
  
  <blockquote>
    <p>Cannot read property 'Ascending' of undefined</p>
  </blockquote>