angularjs - IE 8 选择 n+1 索引

标签 angularjs

使用 IE 8,如果我有一个像这样的选择列表......

            <select required ng-options="n for n in monthNumbers" ng-model="month">
            </select>

...然后 Angular 添加一个空白的第一个选项。然后当我选择任何选项时,IE 8 将选择它后面的选项。因此,如果我选择第 1 个月,它将选择第 2 个月。

如果我添加这样的初始元素...
        <select required ng-options="n for n in monthNumbers" ng-model="month">
           <option></option>
        </select>

……那么问题就解决了。 However then Angular won't remove the empty first element when any other item is selected which is the behavior I want.

有没有一种体面的方法来解决这个问题?

最佳答案

我在手动添加的初始选项中添加了 ng-disabled="true",这会阻止人们在 IE 8 中选择它们。

https://stackoverflow.com/a/2031748/221683

关于angularjs - IE 8 选择 n+1 索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17702401/

相关文章:

angularjs - ng-class 中的 angularjs 表达式语法是什么

angularjs - Angular JS - 使用函数重置下拉列表

javascript - Angular源码中的正则表达式

javascript - 如何在 Angular-JS 中为特定行项目声明 closeCell() 方法

javascript - 我应该如何使用带 Angular 灯箱

angularjs - md-tab 导致 $digest 已进行中错误

AngularJS:表达式和 session 存储之间的数据绑定(bind)

javascript - Angular base64 视频插值失败($sce)

javascript - 将图像(base64 字符串)作为文件流上传到 Web API

javascript - 将 var 传递给 angular $resource 成功函数