Assume I have a const enum:
export const enum MyConstEnum{
Value1 = 'Value1',
Value2 = 'Value2',
Value3 = 'Value3'
}
Now I want to use it in my Angular template:
<span *ngIf="name === MyConstEnum.Value1">This has some value</value>
However, this is not possible, because MyConstEnum is not seen by template.
So the question is how to access const enum in Angular html template?
If enum won't be const like this
export enum MyEnum{
Value1 = 'Value1',
Value2 = 'Value2',
Value3 = 'Value3'
}
there is a solution to create property in templates' component
public get MyEnumInComponent() {
return MyEnum;
}
and MyEnumInComponent will be accessible in HTML.
However, I have const enum.
For this I cannot defined property like above. What is the solution (except changing const enum to enum)?
