mat-optgroup and mat-option don't support nested structure
See original GitHub issueBug, feature request, or proposal:
mat-optgroup and mat-option don’t support nested structure
What is the expected behavior?
i expect mat-optgroup and mat-option support nested structure
What are the steps to reproduce?
click it
open this url and replace template app/select-optgroup-example.html
with follow code:
<mat-form-field>
<mat-select placeholder="Pokemon" [formControl]="pokemonControl">
<mat-option>-- None --</mat-option>
<mat-optgroup *ngFor="let group of pokemonGroups" [label]="group.name"
[disabled]="group.disabled">
<mat-option *ngFor="let pokemon of group.pokemon" [value]="pokemon.value">
{{ pokemon.viewValue }}
</mat-option>
<mat-optgroup *ngFor="let group of pokemonGroups" [label]="group.name"
[disabled]="group.disabled">
<mat-option *ngFor="let pokemon of group.pokemon" [value]="pokemon.value">
{{ pokemon.viewValue }}
</mat-option>
</mat-optgroup>
</mat-optgroup>
</mat-select>
</mat-form-field>
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular CLI: 1.5.2
Node: 8.9.1
OS: win32 x64
Angular: 5.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
@angular/cdk: 5.0.0-rc0
@angular/cli: 1.5.2
@angular/material: 5.0.0-rc0
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Angular MatOptGroup Autocomplete with nested JSON structure
I solved it. export const _filterChildren = (opt: Database[], value: string): Database[] => { const filterValue = value.
Read more ><optgroup>: The Option Group element - MDN Web Docs
The <optgroup> HTML element creates a grouping of options within a <select> element. ... Note: Optgroup elements may not be nested.
Read more >How To Customize Mat Select Option Group To Allow Nested ...
The <mat-optgroup> element can be used to group common options under a subheading. but can be configured to allow multiple selection by setting...
Read more >Create a Nested Multi-select Tree with in Angular
Part 1: Introducing the MatTree. Traditional SELECT elements have long allowed multiple selections via the multiple attribute. The means for ...
Read more >grouped select/options from nested data
You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
hi all, I found a better workaround: just put another mat-select inside the mat-optgroup. Here is my example:
Hello. This feature would be appreciated. Is it planned to be implemented ? Is there any workaround otherwise ? Thank you