Components: Cant make deep nested mat-options inside mat-select

Created on 12 Mar 2018  路  6Comments  路  Source: angular/components

Bug, feature request, or proposal:

*ngTemplateOutlet not working with ng-container in mat-select

What is the expected behavior?

i expect to see mat-options generated in template in mat-select

What is the current behavior?

mat-select havnt any options

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

https://stackblitz.com/edit/angular-5fnbkr?embed=1&file=app/app.component.html

What is the use-case or motivation for changing an existing behavior?

to make available the creation of nested options inside mat-select

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

all info in stackblitz example provided above
https://stackblitz.com/edit/angular-5fnbkr?embed=1&file=app/app.component.html

rxjs: 5.5.6
core-js: 2.5.3
zone.js: 0.8.20
hammerjs: 2.0.8
@angular/cdk: 5.2.4
@angular/platform-browser-dynamic: 5.2.8
@angular/core: 5.2.8
@angular/http: 5.2.8
@angular/forms: 5.2.8
@angular/common: 5.2.8
@angular/router: 5.2.8
@angular/compiler: 5.2.8
@angular/material: 5.2.4
@angular/animations: 5.2.8
@angular/platform-browser: 5.2.8

P5 materiaselect feature needs discussion

All 6 comments

Very useable to have dynamic grouping for your items, currently i need to copy-paste the element through my code.

Is there a workaround for this problem at the moment?

No updates?

Unless I'm missing something, you should be able to acheive the same thing using mat-optgroup and mat-option, like this: https://stackblitz.com/angular/dljkbmrqvja?file=src%2Fapp%2Fselect-optgroup-example.html

@mmalerba I'm not sure but I thought that this issue was created because we don't have an option to create nested mat-options as mat-optgroup is not selectable.

For example in my case I had some brands and each brand has multiple stores. The client should have the option to see the data (ex. number of visitors) collected for one store or all the stores by selecting just the brand name. The reason why this should be nested is because we still want to give the client some structure so they can find their stores in an easy way.
image

I am ofcourse not sure if this is the way to handle such things.

Hmm ok, I didn't realize you wanted the groups to be selectable. I'll reopen this as a feature request, but we'll need to verify whether this actually makes sense from an accessibility standpoint

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LoganDupont picture LoganDupont  路  3Comments

vanor89 picture vanor89  路  3Comments

crutchcorn picture crutchcorn  路  3Comments

kara picture kara  路  3Comments

theunreal picture theunreal  路  3Comments