I am working with a promise called role$: Promise<Role>
, where Role
is an enum containing multiple values like ROLE1
and ROLE2
.
In my template, I want to display the value of role$
:
<ng-container *ngIf="authService.role$ | async as role">
{{role}} <!-- only visible if role is greater than 0 -->
</ng-container>
The issue I am facing is that even when the promise has a value, once it reaches 0 (representing the first enum ROLE1
), the *ngIf
condition remains false causing no content to be displayed. Is there a way to bind role$
directly to role
without relying on *ngIf
or assigning custom values to the enums starting at 1?