Here is a sample list:
export enum UserRoleType {
masterAdmin = 'ROLE_MASTER_ADMIN'
merchantAdmin = 'ROLE_MERCHANT_ADMIN'
resellerAdmin = 'ROLE_RESELLER_ADMIN'
}
export const AdminRoleType2LabelMapping = {
[UserRoleType.masterAdmin]: 'Master Admin'
};
export const MerchantRoleType2LabelMapping = {
[UserRoleType.merchantAdmin]: 'Merchant Admin'
};
export const ResellerRoleType2LabelMapping = {
[UserRoleType.resellerAdmin]: 'Reseller Admin'
};
public ResellerRoleType2LabelMapping = ResellerRoleType2LabelMapping;
public roleTypes = Object.values(UserRoleType).filter(value => typeof value === 'string');
Let's create a dropdown menu:
<select class="custom-select" formControlName="role">
<option [value]="roleType" *ngFor="let roleType of roleTypes">{{ ResellerRoleType2LabelMapping[roleType] }}</option>
<div class="help-block form-text with-errors form-control-feedback" *ngIf="controlHasErrors('role')">
{{controlValidateMessage('role')}}
</div>
</select>
I attempted to simplify the keys like this:
public roleTypes = Object.keys(UserRoleType).filter(value => typeof value === 'string');
However, I am encountering blank rows. Any idea on how to debug and resolve this issue?