i created grid list with column 6 and i want to be grid title take 100% width on small screen devices. Now it creates 6 column on small screens as well
Expected: One grid-title occupies 100% of space on mobile device only
i created grid list with column 6 and i want to be grid title take 100% width on small screen devices. Now it creates 6 column on small screens as well
Expected: One grid-title occupies 100% of space on mobile device only
You may use the following directive if you need a reusable solution:
Addition to the @Leo Caserio' s answer, if you get an error on the first load as follows:
You can use
subject
:Component
Template
Note: @angular/flex-layout": {"version": "8.0.0-beta.26" }
Great work everybody!
I made some further improvements to Алексей Сердюков's Answer:
Gist @ GitHub: https://gist.github.com/mzellho/7fc7d5bd52a29948c47911a993547dad
I liked Altus answer, but I would like to have more breakpoints. So I've created a simple method with some breakpoints using FlexLayout ObservableMedia service instead of onResize:
See https://stackblitz.com/edit/angular-responsive-material-grid-leocaseiro
You have to set the
cols
attribute of themat-grid-list
dynamically depending on the screen width. You'd have to decide on which width breakpoint will themat-grid-list
render the 1-column version.HTML:
TS:
Stackblitz demo here
Hope this helps!