Components: not able to use ng-container within mat-grid-list

Created on 23 Aug 2018  路  4Comments  路  Source: angular/components

Bug, feature request, or proposal:

Allow ng-container to work inside mat-grid-list

What is the expected behavior?

Being able to use ng-container inside mat-list-grid, so it would allow to have ngSwitch or *ngFor doing some logic before creating the item.

What is the current behavior?

If you try to add ng-container nothing is rendered.

What are the steps to reproduce?

1 - Create a mat-grid-list
2 - Add ng-container with ngFor or ngSwitch
3 - Add the mat-grid-tile, and nothing is rendered

https://stackblitz.com/edit/angular-material2-issue-8vvb8z

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

Being able to generate a dashboard dynamically based on the type of component you need to load, and use breakpointObserver to define the number of columns based on the type of the widget.

For example:
widget 1 loads a map
widget 2 loads a random number of charts, where it chart should be a tile

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

Angular 6.1.2
Angular Material 6.4.5
macOS 10.13.6
Typescript 2.9.2
All Browsers

P3 has pr

Most helpful comment

Please reopen this issue. It is not fixed in @angular/[email protected]

See my Stackblitz link here: https://stackblitz.com/edit/angular-material2-issue-zdxvqh

I try to use ng-container with ng-template because i want to transclude the content instead of having that as a string.

All 4 comments

mat-grid-list is an host element, you shouldn't rely on ng-container for your structural directives and use them directly in mat-grid-list balise tag.

@geromegrignon Yes I understand, but I still think that limiting it to accept only mat-grid-tile as its child, does not allow too much flexibility on a more complex view. And while I could use flex-layout to achieve the responsive the design I need, it would not be as easy to maintain as using the grid.

Please reopen this issue. It is not fixed in @angular/[email protected]

See my Stackblitz link here: https://stackblitz.com/edit/angular-material2-issue-zdxvqh

I try to use ng-container with ng-template because i want to transclude the content instead of having that as a string.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanor89 picture vanor89  路  3Comments

savaryt picture savaryt  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

constantinlucian picture constantinlucian  路  3Comments

LoganDupont picture LoganDupont  路  3Comments