如何在 Angular Material 中的多选下拉列表关闭时触发事件? 这是我的 HTML 模板
<mat-select multiple
(focusout)="triggerEvent($event)">
<mat-option *ngFor="let option of templateOptions"[value]="option">
{{option.name}}
</mat-option>
</mat-select>
</mat-form-field>
截至目前,每次选择选项时都会触发事件。我希望当用户完成选择所有值并在外部单击时触发它。我也尝试过模糊,但结果相同。
最佳答案
<mat-select multiple (openedChange)="triggerEvent($event)">
<mat-option *ngFor="let option of templateOptions"[value]="option">
{{option.name}}
</mat-option>
</mat-select>
您似乎在寻找 openedChange 事件发射器。切换选择面板时发出的事件。
关于javascript - 在 Angular Material 中关闭多选下拉菜单时触发事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57653608/