Select 框占位符选项 select 默认值为空字符串或未定义或 null

Select box placeholder option select default in value empty string or undefined or null

我想要页面呈现时间 select select 框值 empty stringundefinednull

中的占位符选项

My sample angular code

它只工作了一个值(empty string)。

但是我想要以上三个值(empty string or undefined or null)

我猜测的需求解决方案是选项中带有Or符号的值。

例如:

<option [value]="''||undefined||null" disabled selected>Select Product</option>

但是不行。如果有人知道解决方案与我分享

[value] 不能接受逻辑表达式。很简单,当你看到模型是null或者undefined:

时,给模型赋值''
this.item.genericByProd = this.item.genericByProd || '';