angularangular-flex-layoutangular-grid

Combine usage mat-grid and flexLayout


state: I build my forms with angular-flex-layout but I need to use the angular-grid with flex too, how can I use flex and grid together??

  <div fxLayout="row wrap" fxLayoutGap="15px">
    <ng-container *ngFor="let widget of containerList">
      <ng-container *ngIf="widget.widgetType.name === widgetTypeEnum.form.name">
        <div fxFlex="auto">
        <app-form-widget [data]="widget.config"></app-form-widget>
        </div>
      </ng-container>
    </ng-container>

    <ng-container *ngFor="let widget of containerList">
      <ng-container *ngIf="widget.widgetType.name === widgetTypeEnum.tree.name">
        <div fxFlex="auto">
          <app-tree-widget [data]="widget.config"></app-tree-widget>
        </div>
      </ng-container>
    </ng-container>

    <ng-container *ngFor="let widget of containerList">
      <ng-container *ngIf="widget.widgetType.name === widgetTypeEnum.table.name">
        <div fxFlex="auto">
        <app-table-widget [data]="widget.config"></app-table-widget>
        </div>
      </ng-container>
    </ng-container>

    <ng-container *ngFor="let widget of containerList">
      <ng-container *ngIf="widget.widgetType.name === widgetTypeEnum.tab.name">
        <div fxFlex="auto">
        <app-tab-widget [data]="widget.config"></app-tab-widget>
        </div>
      </ng-container>
    </ng-container>
  </div>


Solution

  • You don't use them at the same time on the same element.

    <div gdColumns="repeat(5, 1fr)">
      <div fxLayout="row" fxLayoutAlign="start center">
        ...
      </div>
    </div>