question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FxLayout element with fxHide.xs doesn't hide on media changes

See original GitHub issue

Bug 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
CaerusKarucommented, Dec 20, 2018

The issue is a conflict with fxLayout, so that’s the one that needs to be parsed out. You can keep fxHide, but replace fxLayout with style="display: flex; flex-direction: row. The direction part won’t be affected by fxHide, so if you need to make it responsive, you can use ngStyle 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.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 5, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found