angularangular-material2angular-flex-layout

Angular - fxFlex has no effect on elements


This question is related to Angular 2+ and the @angular/flex-layout package.

When trying to use fxFlex="30" for example, CSS styles are not being applied to elements.

<mat-toolbar fxFlex="30" color="primary">
    <h2>Uh-oh</h2>
</mat-toolbar>

Solution

  • Make sure you import the module in app.module.ts like so:

    import { FlexLayoutModule } from '@angular/flex-layout';
    

    and also add it to imports in @NgModule.