Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 431 Bytes

select-option-with-default-value.md

File metadata and controls

15 lines (13 loc) · 431 Bytes

Select option with default value

If you don't want to add an extra value to your data binded list then use this code:

Template:

          <select [(ngModel)]="d" style="width: 100%;" (change)="databaseChange($event.target.value)">
            <option [value]="null">Select Database</option>
            <option *ngFor="let g of databases;" [ngValue]="g">{{g}}</option>
          </select>

Ts:

  d = null;