I'm using Angular Material for creating a form. For some fields the user should get a autocomplete function. Those fields should be also populated from the backend, if the user provides a serial number.
My question is, how can I set the text of a textbox which is linked to a autocomplete via code?
I copied a StackBlitz and modified it to match my scenario: https://stackblitz.com/edit/angular-material-autocomplete-async1-jxrahv?file=src%2Fapp%2Fapp.component.ts
If you click on the "click me!" Button, I want the text of the textbox to change to "Windstorm" (which doesn't happen).
Thanks!
[matAutocomplete]="auto"
to input MatAutocompleteTrigger value accessor starts handling all forms events. And MatAutocompleteTrigger uses displayWith method to write in input value. github.com/angular/material2/blob/… – yurzui