Reed Gesteland
Nov 4 · 1 min read

Thank you for this great control.

In version 1.3 I can see that it is possible to use a custom name for [display] and [value]. In my case, I want to set display and value to be the same field in a one dimensional array. I can see that the value is set properly, but the control field value is not being set. It comes up blank. However, if I change the field name in the array to “value”, the field value displays properly.

This works:

<form [formGroup]=”profileForm” >

<mat-select-autocomplete

[placeholder]=”’Select Options’”

[options]=”options”

[multiple]=’false’

[display]=”’value’”

[value]=”’value’”

name=”optionsSelector”

ngDefaultControl

[formControl]=”profileForm.controls[‘selected’]”>

<! — To use formControl within formGroup, provide [formControl] = formGroupName.controls[‘formControlName’] otherwise just [formControl] = ‘formControlName’ →

</mat-select-autocomplete>

</form>

This does not work:

<form [formGroup]=”profileForm” >

<mat-select-autocomplete

[placeholder]=”’Select Options’”

[options]=”options”

[multiple]=’false’

[display]=”’otherName’”

[value]=”’otherName’”

name=”optionsSelector”

ngDefaultControl

[formControl]=”profileForm.controls[‘selected’]”>

<! — To use formControl within formGroup, provide [formControl] = formGroupName.controls[‘formControlName’] otherwise just [formControl] = ‘formControlName’ →

</mat-select-autocomplete>

</form>

    Reed Gesteland

    Written by