In my dropdown list of objects, I have a person object with properties like id
, firstName
, and lastName
.
<select formControlName="person">
<option *ngFor='let person of persons" [ngValue]="person">{{person.firstName+' '+person.lastName}}</option>
</select>
Suppose I want to determine if a specific person object is already in the dropdown list. If it exists, I would like that person object to be automatically selected as the default value in the dropdown list.