angular select placeholder code example

Example 1: placeholder in angular 9 select

Set initial value of month = null in the component.ts and
add [(ngModel)]="month" in the select tag of component.html.

//component.ts
month = null;

//component.html
<form  #filter="ngForm" (ngSubmit)="filterta(filter)" style="display: flex;">
       <select name="month" [(ngModel)]="month" #month required>
                <option [ngValue]="null" [disabled]="true" >All</option>
                <option value="1">January</option>
       </select>
</form>

Example 2: placeholder in angular 9 select with working required

[value]="" selected hidden
//add hidden with selected