Mat-button-toggle餐饮用于多选
我目前有一个mat-button-toggle-group Active,如下所示: 该按钮的数组为1,2,3,全部没有。多选已启用了多选,因此可以选择以下选项之一。我该怎么办,如果选择了1,2或3,然后选择“无”,则清除了先前的编号选项,以便仅选择任何选项。同样,如果选择了一切。
<mat-button-toggle-group #group="matButtonToggleGroup" style="margin-left: -100%; margin-right:20px" appearance="legacy" name="fontStyle" aria-label="Font Style" [value]="selectedTime" (change)="onValChange(group.value)" multiple>
<mat-button-toggle style="color: black" disabled>Time</mat-button-toggle>
<mat-button-toggle *ngFor="let time of getTime()" style="outline: none !important;" [value]="time.timeno" (click)="changeTimeSelection(time.timeno, time.begin, time.end)">{{time.timeno}}</mat-button-toggle>
</mat-button-toggle-group>
I currently have a mat-button-toggle-group active as follows:
The button is populated with an array of 1,2,3,All,None. Multi-select has been enabled so more than one of the following options can be selected. How can I make it that if 1,2 or 3 is selected and then 'None' is selected that the previous numbered options are cleared so that only None is selected. Likewise if All is selected.
<mat-button-toggle-group #group="matButtonToggleGroup" style="margin-left: -100%; margin-right:20px" appearance="legacy" name="fontStyle" aria-label="Font Style" [value]="selectedTime" (change)="onValChange(group.value)" multiple>
<mat-button-toggle style="color: black" disabled>Time</mat-button-toggle>
<mat-button-toggle *ngFor="let time of getTime()" style="outline: none !important;" [value]="time.timeno" (click)="changeTimeSelection(time.timeno, time.begin, time.end)">{{time.timeno}}</mat-button-toggle>
</mat-button-toggle-group>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
ChangeTimesElection
中按下或弹出所需的值。 %2fapp%2ftoggle.component.ts,src%2FAPP%2FAPP.COMPONEN.PONENT.HTML“ rel =” nofollow noreferrer“> demo
You can push or pop required values inside
changeTimeSelection
method something likeHere is working demo