gpt4 book ai didi

angularjs - IE 8 选择 n+1 索引

转载 作者:行者123 更新时间:2023-12-03 08:13:26 24 4
gpt4 key购买 nike

使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com