【发布时间】:2014-10-06 13:16:44
【问题描述】:
所以我使用 angular,这是我选择的 html:
<select id="date" ng-model="selectedDay" ng-change="setDate()" >
<option>another option</option>
<option>an option</option>
</select>
这是在我的控制器中:
$scope.selectedDay;
document.getElementById("date").selectedIndex = "0";
结果:三个选项:一个空白(默认选中),然后是我在html中做的两个选项
什么鬼?为什么当我打开视图“另一个选项”时不是默认的
【问题讨论】:
-
在 AngularJS 中使用
select时使用ngOptionsdocs.angularjs.org/api/ng/directive/select
标签: javascript html angularjs default selectedindex