Hello I am trying to use a conditional class with an enum. I have used enums in html before with ngSwitchCase 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.
working example:
<ng-container *ngFor="let column of columns" [ngSwitch]="column.dataType">
<td *ngSwitchCase="DataType.Text">{{getPropertyValue(row,column.propertyName)}}</td>
<td *ngSwitchCase="DataType.Date">date</td>
<td *ngSwitchCase="DataType.Number">number</td>
<td *ngSwitchDefault>default</td>
</ng-container>
ts
private DataType = DataType;
not working:
<span *ngClass="(column.sortType === SortType.Ascending)? 'privilege-grid-sortasc': (column.sortType === SortType.Descending)?'privilege-grid-sortdesc':'privilege-grid-sortnone'"></span>
I also have tried [ngClass] ="{'class-name': var === enum,...}"
ts
private SortType = SortType;
error message:
Cannot read property 'Ascending' of undefined