Jai Kumaresh
Jai Kumaresh

Reputation: 835

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

I want to page rendering time select the placeholder option in that select box value empty string or undefined or null

My sample angular code

It's worked only one value(empty string).

But I want the above three value(empty string or undefined or null)

My requirement solution for my guess is values with Or-symbol in option.

For ex:

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

But it does not work. If anybody knows that solution share with me

Upvotes: 0

Views: 750

Answers (1)

31piy
31piy

Reputation: 23869

[value] cannot accept a logical expression. Simply, assign the value '' to the model when you see that the model is null or undefined:

this.item.genericByProd = this.item.genericByProd || '';

Upvotes: 1

Related Questions