如何制作三个状态的复选框

时间:2020-04-21 14:08:09

标签: angular checkbox

我现在想使用具有三个状态(一个用于在线用户/另一个用于脱机,第三个用于所有状态)的复选框来进行过滤,现在我已经成功创建了一个用于过滤关闭元素的复选框,但是我想使用该复选框取代了我的常规复选框。

<mat-header-cell *matHeaderCellDef fxHide fxShow.gt-sm>Etat d'inst
                        <mat-checkbox [checked]="isSelected" (change)="onCheckboxChangeFn($event)" class="check_box_header"></mat-checkbox>
                    </mat-header-cell>
                    <mat-cell *matCellDef="let element" fxHide fxShow.gt-sm> 

1 个答案:

答案 0 :(得分:0)

检查一下

<mat-checkbox [(ngModel)]="checked" [(indeterminate)]="indeterminate">
       CheckBox
</mat-checkbox>

为第三种状态添加indeterminate = true 。参考:https://material.angular.io/components/checkbox/examples

相关问题