I have a Angular FormControl with an array of objects. One object looks like:
{id: 'id', title: 'title'}
I have a formControl within a formGroup with other formControls.
fc= null;
this.fc= new FormControl(this.array);
this.form = this.formBuilder.group({
fc: this.fc,
...
});
Now a have a mat select in my html:
<mat-select formControlName="fc" placeholder="Test" multiple>
<mat-option *ngFor="let op of test" [value]="op.title">{{ op.title }}</mat-option>
</mat-select>
How can I say that the formControl should use the title property of the object to show the initital value that is in the array? If I map the array only to the title property all works fine.
this.fc= new FormControl(this.array.map(x=>x.title));
But I need the whole object in my form.