Let's say that I attach an array to a select tag using the following:
<select ng-model="selData" ng-options="$index as d.name for d in data">
In this case, the corresponding option tags are assigned a sequence of index values: (0, 1, 2, ...). However, when I select something from the selData , the selData value selData bound to undefined . Should binding really work?
On the other hand, let's say that I do the following instead:
<select ng-model="selData" ng-options="d as d.name for d in data">
Here, the option tags get the same index, but the whole object is tied to the change. Does this work by design, or is this behavior just a good mistake or a side effect of AngularJS?
angularjs html-select
Jim Cote Dec 17 2018-12-12T00: 00Z
source share