Following the controller logic:
$scope.form_data = {
day: 'Day'
};
$scope.days = [
'Day',1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19,20,
21,22,23,24,25,26,27,28,29,30,
31
];
In the html section:
<select ng-model="form_data.day" ng-options="day for day in days"></select>
The output is as follows:
<select ng-options="day as day for day in days" ng-model="form_data.day" class="ng-pristine ng-valid ng-touched">
<option value="string:Day" label="Day" selected="selected">Day</option>
<option value="number:1" label="1">1</option>
<option value="number:2" label="2">2</option>
....
</select>
Everything works fine, but Iām struggling to find a way from the documentation on how to set the option value as the array key. In other words, for the first option in the example above, I need its value to be 0, which corresponds to the first position in the array.
Is there a solution using ng-options?