I am experiencing some troubles with a select multiple drop-down. I can select multiple values and save them to a in memory api. The only problem is when I want to edit the item and fill the selected items.
I have a working plnkr here. The component is app/trip/trip-creation.component.ts
here is my html:
<select formControlName="user" multiple>
<option *ngFor="let user of users" [ngValue]="user">
{{user.name}}
</option>
</select>
here is the form binding:
this.route.paramMap
.filter(params => params.get('id') !== null )
.switchMap(params => this.tripService.getTrip(params.get('id')))
.subscribe((trip: any) => {
this.trip.patchValue({
id: trip.id,
name: trip.name,
user: trip.user
});
})