How can I utilize the Enum from BE in an HTML template? Should I use it as is, or provide another one in FE? What is considered best practice?
export interface UserModel {
id?: number;
email?: string;
password?: string;
gender?: UserModel.GenderEnum;
createdAt?: Date;
deletedAt?: Date;
updatedAt?: Date;
}
export namespace UserModel {
export type GenderEnum = 'male' | 'female';
export const GenderEnum = {
Male: 'male' as GenderEnum,
Female: 'female' as GenderEnum
};
}
What should be placed in place of "?????" in the following FE code snippet:
<mat-radio-group class="radio-group" id="gender" formControlName="gender" required>
<mat-radio-button class="radio-button" [checked]="user.gender === ?????" value="1">{{'user.male' | translate}}</mat-radio-button>
<mat-radio-button class="radio-button" [checked]="user.gender === ?????" value="0">{{'user.female' | translate}}</mat-radio-button>
</mat-radio-group>