In my HTML, I have a ng-options
list set up with a select element like this:
<select
required="required"
ng-model="vm.selectedOption"
ng-options="item.name as item.label for item in vm.options">
<option value="">Select an option</option>
</select>
However, the rendered HTML shows:
<option value="string:VALUE" label="Option Name">Option Name</option>
I am using Angular version 1.4.8 and I'm wondering if anyone knows how to fix the issue with the string:
prefix or can explain why it's happening.
The array vm.options
looks like this:
[
{
"name": "INFILL_AUTOMATIC",
"label": "Automatic"
},
{
"name": "INFILL_GRID",
"label": "Grid"
}
]
//EDIT:
When I log vm.selectedOption
, I see the correct value. So the ng-model
is accurate. But why is Angular adding the prefix to the default value
? Is it related to the type definition for the ng-model
perhaps?