0
In the database I save an integer number to represent the user type. The integer number can receive 1, 2, 3, 4, 5, 6 or 7.
When I show the type of user on the screen, I would have to do several *ngIf to show the value in the html component.
<td *ngIf="user.profile == 1"> Administrador </td>
<td *ngIf="user.profile == 2"> Avaliador </td>
<td *ngIf="user.profile == 3"> Responsável </td>
E outros 4 *ngIf para validar o restante...
To not have to do these *ngIf, would you have a better way? I didn’t want to put 7 validations just to show a result in the html component.
What was certain was its api to return a field containing this number and a field with the name of the field. Ai Voce would only use thus: {user.}}
– Eduardo Vargas
Vc tbm can use enums in your typescript but it would be a hard-coded solution that if something changes in the backend you have to change in the front tbm.
– Eduardo Vargas
@Eduardovargas as would be the validation to compare with Enum?
– Guilherme Nass