I am working with an enum in Java that looks like this:
public enum myEnum{
enum1("enumDisplayVal1"), enum2("enumDisplayVal2")
myEnum(String displayValue) { this.displayValue = displayValue;}
private String displayValue;
public String getDisplayValue(){return displayValue}
}
Now, in AngularJS, I want to create a select dropdown using the values from the enum.
<select class="multiselect" multiple="multiple" id="enumDropDown"
data-ng-change="update()"
data-ng-options="e for e in myEnumValues"
data-ng-model="selectedEnum">
<option value="">All</option>
</select>
Currently, the dropdown displays values like enum1, enum2 which are the actual values of the enum. How can I modify it to show the "displayValue" property instead?
To send the enum values to AngularJS, I use myEnum.values()