This is my select code :
<select class="form-control" [(ngModel)]="selectedPrototypeSelector" (ngModelChange)="onPrototypeChange()">
<option *ngFor="#p of prototypes" [value]="p.selector">
{{ p.selectorName }}
</option>
</select>
How do I set a standard begin value to this select option
I thought i have to set this variable:
selectedPrototypeSelector: string;
To this: selectedPrototypeSelector: string = "Test";
But the "Test"
is not showing first in the select box The begin value is empty, how do I set this for example to: Select your option.
Here a PLUNKER ,
as you can see the select box is empty while i set the value p.selector
and the same for the second select where i give the value of constraint
:
<select class="form-control" [(ngModel)]="expression.constraint">
<option *ngFor="#constraint of prototype.constraints" [value]="constraint">
{{ constraint }}
</option>
</select>
I want to set the begin value of every select box to a static string = "Select an option";