Set default option for select menus in Angular 2+

Set default option for select menus in Angular 2+

I recently needed to add a `please select` default option for <select> menus with a null value. There is a lot of confusing information out there for what should be a simple task, so here is the solutions that worked for me…

Template Driven Forms

<select [ngModel]="field ||"">
<option value="">Select field</option>
<option*ngFor="letpropertyofproperties"[ngValue]="property">{{property.name}}</option>
</select>
Note the change to the ngModel.

Reactive Forms

<select formControlName="field">
<option [ngValue]="null">Selectfield</option>
<option*ngFor="letpropertyofproperties"[ngValue]="property">{{property.name}}</option>
</select>