With IE 8, if I have a select list like so...
<select required ng-options="n for n in monthNumbers" ng-model="month">
</select>
...then Angular adds a blank first option in. Then when I select any option, IE 8 will select the option that comes after it. So if I select month 1, it will select month 2.
If I add an initial element like this...
<select required ng-options="n for n in monthNumbers" ng-model="month">
<option></option>
</select>
... then the problem is fixed. However then Angular won't remove the empty first element when any other item is selected which is the behavior I want.
Is there a decent way around this?
I added ng-disabled="true" to the manually added initial options and that stops people from selecting them in IE 8.
https://stackoverflow.com/a/2031748/221683
Use ng-options
like this:
<select required ng-options="month.value as month.label for month in months" ng-model="month"></select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With