What is the best way to define a TypeScript static constant within a class so that it can be accessed without initializing the class instance? Below is an example of my class structure:
export class CallTree{
public static readonly active = 1;
............................
}
Here is how the component's HTML looks like:
<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>
Upon checking the browser console, I see the error message:
TypeError: Cannot read property 'active' of undefined
How can I resolve this issue? What is the correct way to utilize this constant in the Angular component's HTML?