I've encountered an issue with my custom autocomplete component that implements ControlValueAccessor
. I'm attempting to set the value from the parent component using
form.get('productName').setValue('Product 1');
. While this successfully sets the value in the form, it doesn't reflect in the associated input field for the autocomplete.
In a stackblitz example, I demonstrate the issue where the input fails to display the assigned value. Interestingly, removing the attribute
[matAutocomplete]="auto"
from the input immediately resolves the visibility problem in the UI.
You can view the example here: https://stackblitz.com/edit/angular-autocomplete-form-control?file=src%2Fapp%2Fapp.component.ts
I also attempted the solution mentioned in this thread (link provided), but unfortunately, it didn't yield any success -