I want to get selected value dropdown based on value of ngModel
:
<div class="form-group">
<div>
<label class="dropdown" for="profile">Profile <span style="color:red">*</span></label>
</div>
<div class="half">
<select class="form-control" name='profile' [(ngModel)]='users.profile._id' required>
<option *ngFor="let obj of profiles" [value]="obj._id">{{obj.profile}}</option>
</select>
</div>
</div>
Thanks @Günter Zöchbauer and @Stefan Svrkota
I have intialize
this.users.profile=''
as string previously which was my mistake it should be inialize as objectthis.users.profile={}
,remaining code is working.