This plunker is from Angular ngOptions
sample:
ngOption/Select Angular Sample
However, I added an ngIf
to the first select
resulting in:
<div ng-if="1<2">
Color (null not allowed):
<select ng-model="myColor" ng-options="color.name for color in colors"></select><br>
</div>
Something interesting that you may notice is that the ngIf
breaks the ngModel
binding and nothing happens when you change your selection.
Because the same code without the ngIf
produces the expected results.
Can you please confirm if this is a bug in angular, my code and/or if there is a work around it?