是否可以为 mat-checkbox 和 mat-checkbox 标签制作不同的点击事件?

Is it possible to make different click event for mat-checkbox and mat-checkbox label?

我需要为 mat-checkbox 及其标签设置不同的点击事件。谁帮我解决这个问题。

您可以执行以下操作来完成此操作。

将标签文本放在 span 中,(click) 用于 span(change) 用于 mat-checkbox

<mat-checkbox (change)="SetString('CheckBox')"></mat-checkbox>
<span style="margin-left:2%" (click)="SetString('CheckBoxTag')">Click here for tag event!</span>

Stackblitz

https://stackblitz.com/edit/angular-z1pgeg?embed=1&file=app/checkbox-overview-example.html