Check out this plunker showcasing Angular's ngOptions
feature:
Angular Select Options Plunker
I decided to spice things up by adding an ngIf
directive to the initial select
element:
<div ng-if="1<2">
Color (null not allowed):
<select ng-model="myColor" ng-options="color.name for color in colors"></select><br>
</div>
An interesting observation is that the ngIf
seems to disrupt the ngModel
binding, rendering the selection change ineffective.
Remarkably, removing the ngIf
results in the expected behavior.
Could you please verify whether this issue lies within Angular, my implementation, or if there is a workaround available?