This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
cannot use ng-if on select default option any more #12951
Closed
Description
I cannot conditionally have a default option for a select using ng-if. See here: http://plnkr.co/edit/lGaZeIFHBUTVciqNMp2B?p=preview
I was able to do that with Angular 1.3.x. With Angular 1.4.x instead of an adding a default option, the default option is displayed as selected in the closed select box, but in fact the first real option is selected. That's independent of wether ng-if is true or false.
When I resort to ng-show it works correctly in the "true" case. However, in the "false" case, it will show the default option as selected although when opening the select (or inspecting the element), it's not there.
As a workaround one can use ng-show and set an option as selected explicitly.