Angular Flex Layout - Not working Angular Flex Layout - Not working angular angular

Angular Flex Layout - Not working


I also got like that problems when I install the lasted flex-layout module. The problems is directive name changes.In website, all of the directive are like layout, layout-xs, flex etc...

According to my solution, directive name are changed to fx + PascalCase.

Example

layout -> fxLayoutflex -> fxFlexflex-order -> fxFlexOrderflex-order-gt-md -> fxFlexOrder.gt-md

If you check Layout and Container, you will see as below image.

enter image description here

Change above source code to as the following, it is OK for me.

<div fxLayout="row">    <div fxFlex>First item in row</div>    <div fxFlex>Second item in row</div></div><div fxLayout="column">    <div fxFlex>First item in column</div>    <div fxFlex>Second item in column</div></div>


I ran into this issue too and the cause was me using multiple modules and I forgot to import the FlexLayoutModule in my "PagesModule" modules.

It would work on the main page because it was imported at the top level (AppModule) and not on the child modules.

Importing it in the "PagesModule" and restarting the development server fixed it for me.


This is more of a generic problem, but catches me once in a while:

Make sure your project is actually compiling!

If you have an error and the project doesn't compile, then HTML changes won't be shown - which includes directives being added. So if you add a directive to existing code and don't see the change make sure your compile completes.

Don't get muddled up with the names

-Use fxLayout and not fxFlexLayout

-Use fxLayoutAlign and not fxFlexLayoutAlign