Reputation: 76
The Angular Material documentation has an example of option groups, but the top level options (Pokemon types in this case) aren't selectable.
Is there a way to enable them as selectable, in addition to the nested options?
To clarify: I'd like to make the top-level option group selectable by itself (e.g., it doesn't need to auto-select all the sub-options).
I'm also not married to angular-material, so if there's another easy way to implement this I'm game.
Upvotes: -1
Views: 1223
Reputation: 17958
The short answer is no. You cannot make an option group selectable. You could fake it with style, by having an option that represents a group look like a group header (font weight, color), and having the options that are "in" the group look like grouped options (indented). But all selectable items must be <mat-option>
elements.
Upvotes: 1