I made an enum with Typescript to use in MyService.service.ts MyComponent.component.ts and MyComponent.component.html.
export enum ConnectionResult {
Succes
You can bind as text if enum defined as below (those values won't enforce a json string value coming from API)
export enum SomeEnum {
Failure,
Success,
}
In .ts file
public status: SomeEnum;
In .html
Another way, tested in Angular 8+ is to have enums with numbers In .ts file In .html export enum SomeEnum {
Failure = 0,
Success = 1,
}
public status: SomeEnum;