How to create an TypeScript static constant in a class? That mean I can refer a constant without initialize the class. This is my class:
export class CallTree{
public static readonly active = 1;
............................
}
The component's html is something like the following:
<table mat-table [dataSource]="callTreeList" matSort class="mat-elevation-z8 callTreeList">
...............................
<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Status</th>
<td mat-cell *matCellDef="let element" [innerHTML]="(element.status === CallTree.active)?'Active':'Inactive'"></td>
</ng-container>
The browser console prompt the following error message:
TypeError: Cannot read property 'active' of undefined
How can I fix the problem? How can I use this constant in the Angular component's html?