I have this enum (I\'m using TypeScript) :
export enum CountryCodeEnum {
France = 1,
Belgium = 2
}
I would like to build a
I've preferred to have a simple utility function shared across my Angular App, to convert the enum into a standard array to build selects:
export function enumSelector(definition) {
return Object.keys(definition)
.map(key => ({ value: definition[key], title: key }));
}
to fill a variable in the Component with:
public countries = enumSelector(CountryCodeEnum);
and then fill my Material Select as my old array based ones:
{{ c.title }}
Thanks for this thread!