I have the following enum:
export enum Categoria {
Acao = 1,
Opcao = 2,
FundoImobiliario = 3,
ContratoFuturo = 4,
ETF = 5,
BDR = 6
}
I use the following code to return the enum members to the screen:
export function enumSelector(objeto: any) {
return Object.keys(objeto).filter(key => !isNaN(Number(objeto[key])));
}
This enum populates an HTML select. So I select an option and do the post on my form, but what I get is the member name enum. How do I get the enum index? For example: 1 or 2 or 3 etc.
enumanyway. What's wrong with just this using aconstinstead of anenum?