I am currently referencing the enum int value directly in my html view, but I would prefer to reference by the enum name - for example, as I do in
Since the expression context of the template is the component instance, you should assign the NodeType enum to a property of the component class to make it available in the template:
export class ConfigNetworkTreeComponent {
public NodeTypeEnum = NodeType; // Note: use the = operator
...
}
You can then use that property in the template to refer to NodeType values:
*ngIf="selectedNode && selectedNodeType === NodeTypeEnum.HostService"
See this stackblitz for a demo.