Skip to content
This repository has been 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
Archelyst opened this issue Sep 25, 2015 · 1 comment
Closed

cannot use ng-if on select default option any more #12951

Archelyst opened this issue Sep 25, 2015 · 1 comment

Comments

@Archelyst
Copy link

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.

@Narretz
Copy link
Contributor

Narretz commented Sep 25, 2015

This is a dupe of #12190. Here's a PR: #12952

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants