Angular flex-layout with ngFor

前端 未结 2 1308
旧时难觅i
旧时难觅i 2020-12-28 09:42

I am very new to flex-layout and having trouble fixing the following:

https://github.com/angular/flex-layout

My ngFor:

相关标签:
2条回答
  • 2020-12-28 10:01

    With angular 6 and new version of flex-layout my code looking like this:

    <div fxLayout="row wrap">
       ...
    </div>
    
    0 讨论(0)
  • 2020-12-28 10:17

    I found the solution on: How to control number of items per row using media queries in Flexbox?

    HTML:

    <div fxLayout="row" fxLayout.xs="column" fxLayoutWrap="wrap">
      <country fxFlex.gt-xs="50%" [fxFlex.gt-md]="regularDistribution" *ngFor="let country of countries" [country]="country"></country>
    </div>
    

    Typescript:

    //I use this to show of expression bindings in flex-layout and because I don't want the calculated value in the HTML.
    regularDistribution = 100 / 3;
    

    wrap: multi-line / left to right in ltr; right to left in rtl

    The key here is the fxLayoutWrap="wrap"

    0 讨论(0)
提交回复
热议问题