html - FlexLayout Angular 并在开始和结束时在一行中对齐元素

标签 html css angular flexbox angular-material

我在 Angular 7/8 内使用 Angular flexlayout 库。我想在左侧(flex-start)有 4 个按钮,并且我想在右侧(flex-end)有两个复选框在同一级别。 如果可能的话,我想在 flexlayout Angular 库中完成它。

我已经尝试了下面显示的代码。我也尝试制作 2 个 mat-card-action 组件,但它们彼此下方而不是在一条线上。

<mat-card-actions fxLayoutGap="1em">

  <button mat-raised-button color="accent" (click)="newRows()">Add</button>
  <button [disabled]="selectedRow != undefined && selectedRow.isBevoorschotting" mat-raised-button color="accent"
    (click)="updateRows()">Update</button>
  <button mat-raised-button color="warn" (click)="deleteRows()" [disabled]='!isAdmin'>Delete</button>
  <button mat-raised-button color="accent" (click)="refresh(0)">Refresh</button>

  <mat-checkbox (change)="onclickMutatieVelden()" [(ngModel)]="toonMutatievelden">
    <p>Mutatie velden aan...</p>
  </mat-checkbox>
  <mat-checkbox (change)="onclickMaakInactief()" *ngIf="selectedRow" [(ngModel)]="!selectedRow.isActief">
    <p>Maak Inactief...</p>
  </mat-checkbox>
</mat-card-actions>

Anybody can help me out ?

最佳答案

可以这样吗?

<mat-card fxLayout="row">
  <div fxLayout="row" fxLayoutAlign="start center" fxFlex="50"     fxLayoutGap="5px">
      <button mat-raised-button color="accent" (click)="newRows()">Add</button>
      <button [disabled]="selectedRow != undefined && selectedRow.isBevoorschotting" mat-raised-button color="accent"
        (click)="updateRows()">Update</button>
      <button mat-raised-button color="warn" (click)="deleteRows()" [disabled]='!isAdmin'>Delete</button>
      <button mat-raised-button color="accent" (click)="refresh(0)">Refresh</button>
  </div>
  <div fxLayout="row"  fxFlex fxLayoutAlign="end center">
      <mat-checkbox (change)="onclickMutatieVelden()" [(ngModel)]="toonMutatievelden">
        <p>Mutatie velden aan...</p>
      </mat-checkbox>
      <mat-checkbox (change)="onclickMaakInactief()" *ngIf="selectedRow" [(ngModel)]="!selectedRow.isActief">
        <p>Maak Inactief...</p>
      </mat-checkbox>
  </div>
</mat-card>

https://stackblitz.com/edit/flex-layout-angular-material-gxew4y?embed=1&file=app/app.component.html

关于html - FlexLayout Angular 并在开始和结束时在一行中对齐元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57749014/

相关文章:

javascript - Angular JS 将 html 发送到数据库

html - 如何使用 html 将我的 Logo 添加到我的网站

javascript - 数字时钟在 FireFox 中不工作

php - 在 Bootstrap 中对齐段落

javascript - 如何使用普通 JavaScript 附加 <svg> 元素?

html - 将滚动条添加到模态窗口

angular - mat-menu-item 在 Protractor e2e 测试中不可点击

json - 无法将数据绑定(bind)到 Angular Material 数据表

angular - 在服务中使用 ng2-toastr

jquery - 如何在拖放时调整图像的位置