Edit: There are some workarounds as posted below (see answers) for template-driven forms. (I am looking for a solution for reactive forms).
How can I force Angular Material Autocomplete to enter letters only provided by a data source?
>> See the whole app here at stackblitz.com
"Adel" is initial value and it is provided by the options-array:
options: User[] = [
{name: 'George Michael'},
{name: 'Aretha Franklin'},
{name: 'Adel'},
{name: 'Janet Jackson'},
];
The auto-complete works properly:
However, the following should not be possible:
The user may only enter the letters corresponding to an entry in the list, i. the first letters of an existing entry.
If the user attempts to enter letters that do not correspond to any of the existing values, an error message should inform the user: "The entered value must correspond to a list entry".
Is there possibility to do that with Angular Material Autocomplete?