I have made my custom enum (see code), and I would like to reuse the constants declared as FOO and BAR without having to write the value of the constants again in the types array. How would I go about doing that?
var myApp = angular.module('app');
myApp.constant('MyEnum', {
FOO: "foo",
BAR: "bar",
types: [
{id: 0, value: 'foo', label:"Foo"},
{id: 1, value: 'bar', label:"Bar"}
]
});
I would like to do something like this in the types array:
types: [
{id: 0, value: this.FOO, label:"Foo"},
{id: 1, value: this.BAR, label:"Bar"}
]
but doing it like this gives me errors. Any suggestions?