Angular 如何创建三种状态的复选框

Angular 如何创建三种状态的复选框,angular,checkbox,Angular,Checkbox,我想使用带有三种状态的复选框(一种为在线用户/另一种为离线用户,第三种为所有用户)制作一个过滤器。目前,我已成功制作了一个用于在关闭元素上进行过滤的复选框,但我想使用插入我的正常复选框的复选框 <mat-header-cell *matHeaderCellDef fxHide fxShow.gt-sm>Etat d'inst <mat-checkbox [checked]="isSelected" (change)="onChec

我想使用带有三种状态的复选框(一种为在线用户/另一种为离线用户,第三种为所有用户)制作一个过滤器。目前,我已成功制作了一个用于在关闭元素上进行过滤的复选框,但我想使用插入我的正常复选框的复选框

<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> 
Etat d'inst
看看这个

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

复选框
为第三种状态添加
undeterminate=true

.Reference:

mat复选框已作为属性Undeterminate,只是[Undeterminate]=“IsIndeterminate”。如果是一个普通复选框,请参阅以及我如何检测用户是否选择第一个/第二个或第三个复选框对于前两个状态为false和true,对于第三个状态为Undeterminate我发现当我第一次单击复选框时,我无法再选择Undeterminate选项(我想在未选中然后选中然后不确定的3个选项之间切换