New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<optgroup> Support? #47
Comments
If you're options array has a "group" attribute, you can define ng-options like so: ng-options='o.value as o.label group by o.group for o in model.options' |
@Siyfion does this work? |
Sort of... doesn't honor "as" and uses index as value instead. Trying to see what's angular's fault though: https://docs.angularjs.org/api/ng/directive/ngOptions |
The "group by" worked for me. |
You can use "group by" expression {
"teams": [
{"name": "Johan", "email": "johan@mail.com", "group": "one"},
{"name": "Mala", "email": "mala@mail.com", "group": "two"},
{"name": "Saimin", "email": "saimin@mail.com", "group": "one"},
{"name": "Dolah", "email": "doll@mail.com", "group": "three"},
{"name": "Abah", "email": "abah@mail.com", "group": "three"}
]
} then use ng-options="t.name group by t.group for t in teams" |
I've made a plunkr for it: http://plnkr.co/edit/j0yIif?p=preview |
Assuming that I have a collection of elements with a group property, is there a way to use 'ng-options' in such a way that it will produce correct '' tags? As I can't think of a way of doing this...
The text was updated successfully, but these errors were encountered: