ng-options comprehension_expression用于简单数组

时间:2016-01-19 10:27:05

标签: javascript angularjs

非常简单的问题,也许我只是不明白:

这是我的角度MainController中的数组:

vm.upcomingEventDates = [
    "2017-10-13",
    "2017-10-14",
    // [...]
];

这是我的select comprehension_expression:

<select ng-model="vm.booking.nextYearDate" ng-options="events as events for events in vm.upcomingEventDates">

但是他一直把它弄错了(不是吗?):

<select ng-model="vm.booking.nextYearDate" ng-options="events as events for events in vm.upcomingEventDates" class="ng-pristine ng-untouched ng-valid">
    <option value="?" selected="selected" label=""></option>
    <option value="0" label="2017-10-13">2017-10-13</option>
    <option value="1" label="2017-10-14">2017-10-14</option>
    <!-- [...] -->
</select>

我怎样摆脱第一个&#34;错误&#34; value并在value属性中获取日期?

0 个答案:

没有答案