ngOptions does not populate options through selectCtrl (hasOption doesn't work with ngOptions)
Regression(?) of #8761
Support for selectCtrl.hasOption in ngOptions was added in 1.3.x (09eeb48) but was lost as part of the ngOptions/select rewrite in 1.4.0(?) (408f89d)
JSBins - see console whilst changing select values.
1.3.1: http://jsbin.com/sifegicura/1/edit?html,js,output 1.4.5: http://jsbin.com/zufuzuweda/1/edit?html,js,output
I'm trying to write a directive which I can apply across a variety select fields and requires access to the options values that are available to the user using hasOption for check would make this much easier.
Hm, that's a pickle. Since ngOptions is now a standalone directive, there would need to be an interface between ngOptions and select that adds the ngOptions generated options to the selectCtrl. I'm not sure how easy this is, based on the fact that ngOptions now encodes the options differently. If you want to give a PR a shot, though, we'll be happy to look at it.
We can overwrite the hasOption method, same as we do with writeValue etc.
However, two issues:
- the function is undocumented, so we'd need to nail down that it should work a specific way
- case in point: Should hasOption work with the scope.value or with the $viewValue? if you have a parser on ngModel that modifies the currently selected value, you cannot use it with scope.value