FxLayout element with fxHide.xs doesn't hide on media changes
See original GitHub issueBug Report
What is the expected behavior?
<div fxLayout fxHide.xs></div>
respects media changes and hides the element at extra-small screen sizes.
<div fxLayout [fxHide.xs]="booleanVariable"></div>
respects media changes and hides the element at extra-small screen sizes if the booleanVariable
is true. This case is specific to my own code, and I want to make sure it works.
What is the current behavior?
<div fxLayout [fxHide.xs]="booleanVariable"></div>
- On initial load at extra-small screen sizes hides the element
- On resize to a larger size, displays the element
- On resize back to extra-small, does not hide the element.
Note: When the element doesn’t have fxLayout
(e.g. <div [fxHide.xs]="booleanVariable"></div>
), it works properly.
What are the steps to reproduce?
Providing a StackBlitz (or similar) is the best way to get the team to see your issue.
https://stackblitz.com/edit/angular-flex-layout-seed-k1oskk?file=app%2Ftest.component.ts
What is the use-case or motivation for changing an existing behavior?
It’s broken.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 7.1.4 Material 7.2.0 TypeScript 3.1.6
Is there anything else we should know?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
angular-material2 responsive show/hide
I would recommend @angular/flex-layout, as you already mentioned! It's an additional package - installation needed, it's not a part of angular!
Read more >angular/flex-layout
It seems like config that is set in common module is not applied in lazy loaded module. Namely common (not lazy) module imports...
Read more >Video 4: Use fxLayout fxLayoutAlign fxFlex fxFlexOrder fxHide ...
In this video we use fxLayout, fxLayoutAlign, fxFlex, fxFlexOrder, fxHide and fxShow from Angular Flex Layout Support the channel by ...
Read more >Angular Flex Layout: The Masquerade | by Aleix Suau
In this post I'll summarize the possibilities of flexbox and how Angular Flex Layout enrich and simplifies it with a cool declarative and...
Read more >Getting started with Angular Flex-Layout
'flex-align' can change the alignment for a single element only. ... listed below we use a responsive breakpoint fxLayout.xs= “column”.
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 FreeTop 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
Top GitHub Comments
The issue is a conflict with
fxLayout
, so that’s the one that needs to be parsed out. You can keepfxHide
, but replacefxLayout
withstyle="display: flex; flex-direction: row
. The direction part won’t be affected byfxHide
, so if you need to make it responsive, you can usengStyle
for that, e.g.ngStyle="{'flex-direction': 'row'}" ngStyle.xs="{'flex-direction': 'column'}"
.Alternatively you can put these in classes and use responsive
ngClass
.I’ve patched this in #948, so it’ll definitely be fixed in the next release, and I apologize for the confusion in the meantime.
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.