During my Typescript project, I defined an enum like this:
enum Action { None = 0, Registering = 1, Authenticating = 2 };
In the controller, I declared a property named action as follows:
class AuthService implements IAuthService {
action: number;
constructor(
private $state,
private userService,
private utilityService: IUtilityService
) {
this.action = Action.None;
}
doRegister() => {
this.action = Action.Registering;
}
The setup works well, but I'm wondering how to make use of the enum in my HTML markup. Is there a way to achieve this? Ideally, I'd like to incorporate it in a similar manner:
<span ng-class="{'fa-spin fa-spinner': app.authService.authenticating }">
Without having to create separate variables like:
app.authService.authenticating
app.authService.registering
...
etc