I am facing a challenge when trying to input a composed value into a select field. Let's consider our object contains only an ID and a name. The typical way to create a functional select would be:
<mat-form-field>
<mat-label>Placeholder</mat-label>
<mat-select>
<mat-option *ngFor="let i of fooCollection" [value]="i.id">
{{i.name}}
</mat-option>
</mat-select>
</mat-form-field>
While searching for a solution to assign a value, I came across this informative example in the documentation that simply adds a [(value)]
option to the mat-select
tag. However, as we are dealing with a composed object here, this method no longer functions.
Any thoughts on how to resolve this issue? Thank you in advance! Kev'