-
Notifications
You must be signed in to change notification settings - Fork 27.4k
select directive should expose options set by ngOptions #7417
Comments
@pocesar I'm not sure I got the essence of the issue. Are you thinking about the expression like this: <select ng-model="myColor" ng-options="color.name for color in (filteredColors = (colors | filter:'b'))"></select><br>
{{filteredColors}} Here is a plunk: http://plnkr.co/edit/FJywANlXETCOe5Ukk0mG?p=preview Once again, I'm not sure what you exact problem is so please provide a modified plunk if the above doesn't address your use-case. |
the main thing I missed was when creating a directive, since I can use |
@pocesar no, you can't require I'm still not super-clear what is your exact use-case and what is an extension point that you are missing from the |
@pkozlowski-opensource indeed, that's why I couldn't require it. I expected at least that the select controller (through |
+1, It would be very helpful for writing custom select directives to have access to original parsed collection through select controller and/or somehow easily get object bound to the exact option (may be through exposed optionsMap object) |
I wanted my directive that invokes bootstrap select to be able to set the I therefore augmented the ngOptions directive to expose the options: What do people think of this approach? As a usage example, in my case I am only using
If people want a more complete example I can provide that. |
It would be very helpful if there was a public API here. SelectController's documentation seems to blank. I work with a lot of form-heavy applications and one of the use cases (where this situation caused us trouble) was creating a directive that would add an "other" option to the |
since
ngOptions
directive is an expression, and can have filters applied to it, the resulting options array is unknown (bound items and labels). the select directive should expose anoptions
array (or object) containing the array of items.The text was updated successfully, but these errors were encountered: