The selected value of the AutoComplete can only be a string value.
To set the value, use the
[value] property binding of the AutoComplete or the
ngModel binding. When the value changes, the AutoComplete triggers the
- To define multiple values, use the MultiSelect. For more information, refer to its overview article.
- To define selected values as data of the primitive (strings and numbers) or complex (objects) type, use the ComboBox. For more information, refer to its overview article.
- The AutoComplete does not support values, which contain
\nnew line characters. The regular
inputHTML DOM element, which is used internally by the AutoComplete, treats
\nas a regular whitespace. Therefore, when the component compares the value of the
inputelement with the data item that is selected by the user, the two values differ. The value of the
inputelement is actually not present in the data of the component and the AutoComplete does not recognize it. To handle such issues, map the incoming data so that it contains regular whitespaces only.
The following example demonstrates how to select an item in the AutoComplete.