且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如果有条件则防止选择垫选项

更新时间:2023-11-29 15:17:22

我已经设法通过更改代码中的ngModel"filter_defaultSelectedValue"来限制这种特殊情况. 如果在对话框中未选择任何内容,则将ngModel设置为某个先前设置的值:

I've managed to condition this special case by changing in code the ngModel "filter_defaultSelectedValue". If inside the dialog nothing was selected, ngModel is set to some previously set value:

this.filter_defaultSelectedValue = this.lastSelection;

如果选择了对话框中的某些内容,则让我通过mat-select将我的"filter_defaultSelectedValue"更改为该选定值.

If something inside dialog was selected, then I let mat-select change my "filter_defaultSelectedValue" to that selected value.