I have to use the drop down for a field named "reportType". I extracted the value from API as Reportformdetails.reportType
.
The Reportformdetails.reportType
contains two values, such as A and B
I used the below code:
<select class="form-control" name="reportType" #reportType="ngModel" ngModel
[(ngModel)]="Reportformdetails.reportType" (change)="selectInput($event)" >
<option [value]="undefined"> Select </option>
<option [value]="x.value" *ngFor="let x of services" >{{x.name}}</option>
</select>
Now when I see the dropdown, the value A has to be selected by default.
In normal HTML, I can use the selected attribute directly in option value. What do I do here?