Angular Flex Layout - not working
I tried using 2.0.0-beta.9 in my application, a simple test does not work
<div fxLayout="row">
<div>1. One</div> <div>2. Two</div> <div>3. Three</div> <div>4. Four</div>
</div>
displays columns instead of rows
I think I'm importing the library correctly
import {Component, NgModule} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {FlexLayoutModule} from "@angular/flex-layout";
import {TestApp} from "./test-app";
@NgModule({
imports: [
BrowserModule,
FlexLayoutModule
],
declarations: [ TestApp ],
bootstrap: [ TestApp ]
})
export class TestAppModule {
}
I also had such problems when I install the last flex-layout
module. Problems are a change of directive . In the website all the directive is similar to the layout
, layout-xs
, flex
etc.
According to my decision, the name directive
has changed to fx + PascalCase
.
Example
layout -> fxLayout
flex -> fxFlex
flex-order -> fxFlexOrder
flex-order-gt-md -> fxFlexOrder.gt-md
If you check the Layout and the container , you will see the image below.
Change the source code to the following, this is normal 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>
, :
Make sure your project actually compiles!
If you have an error and the project does not compile, then HTML changes will not be shown, including added directives. Therefore, if you add directive to existing code and do not see changes, make sure that compilation is completed.
Don't mess with names
-Use fxLayout
notfxFlexLayout
-Use fxLayoutAlign
notfxFlexLayoutAlign