I have a flags enum property in my backend service (C#) and on the frontend (angular / js) a multi select list which uses an array as source.
If I recreated the enum in javascript, is it possible to take the integer value (from the service) and map it to the flag values? i.e. given the number 6 from my service, I could populate an array (or something) with the values [red, blue] which I could use to populate the multi select.
var myEnum = {
none: 0,
green: 1,
red: 2,
blue: 4
}
I've found a few examples regarding enums in javascript but they don't seem to be exactly what I'm after.
Many thanks