I have defined a status enum with different values such as Draft, Publish, OnHold, and Completed.
export enum status {
Draft = 1,
Publish = 2,
OnHold = 3,
Completed = 4
}
In my TypeScript file, I set the courseStatus variable to have a default value of Draft from the status enum.
courseStatus: status = status.Draft;
When displaying the courseStatus in the HTML using a label element, it shows as an ID instead of the enum value.
<label [for]="'status'">{{courseStatus}}</label>
I attempted to create another variable to hold the string representation of the enum value, but it still displays as a number.
courseStatusValue: string = this.courseStatus.toString();
The issue arises when trying to convert an ID received from the API into the corresponding enum value.