One of the challenges I am currently facing is integrating an enum into my HTML file. Here is the enum in question:
export enum CartAction {
ADD = 'ADD',
REMOVE = 'REMOVE',
}
In the component's TypeScript file, it is being utilized as follows:
async cartAction(action: CartAction): Promise<void> {
if (action === CartAction.ADD) {
}
if (action === CartAction.REMOVE) {
}
}
I aim to use this enum directly within the HTML file, like this:
<button (click)="cartAction(someCondition? CartAction.ADD : CartAction.REMOVE )">text</button>
However, when attempting to do so, I encounter the error message:
Property 'CartAction' does not exist on type 'MyPage'.
Did you mean 'someOtherAction'?ngtsc(2551)
How can I navigate through and resolve this issue?