AutoCompleteComponent
Represents the Kendo UI AutoComplete component for Angular.
@Component({
selector: 'my-app',
template: `
<kendo-autocomplete
[data]="listItems"
[placeholder]="placeholder"
>
`
})
class AppComponent {
public placeholder: string = 'Type "it" for suggestions';
public listItems: Array<string> = ["Item 1", "Item 2", "Item 3", "Item 4"];
}
Selector
kendo-autocomplete
Export Name
Accessible in templates as #kendoAutoCompleteInstance="kendoAutoComplete"
Inputs
disabled
boolean
Sets the disabled state of the component.
filterable
boolean
Enables the filtering functionality.
If set to true
, the component emits the filterChange
event.
highlightFirst
boolean
Defines whether the first match from the suggestions list will be automatically focused.
By default, highlightFirst
is set to true
.
listHeight
number
Sets the height of the suggestions list. By default, listHeight
is 200px.
The
listHeight
property affects only the list of suggestions and not the whole popup container. To set the height of the popup container, usepopupSettings.height
.
loading
boolean
Sets and gets the loading state of the AutoComplete.
placeholder
string
The hint which is displayed when the component is empty.
readonly
boolean
Sets the read-only state of the component.
suggest
boolean
Enables the auto-completion of the text based on the first data item.
tabindex
number
Specifies the tabindex
of the component.
valueField
string
Specifies the string
property of the data item that represents the item value.
If the data contains only primitive values, do not define it.
data
any
Sets the data of the AutoComplete.
The data has to be provided in an array-like list.
itemDisabled
Defines a Boolean function that is executed for each data item in the component (see examples). Determines whether the item will be disabled.
popupSettings
Configures the popup of the AutoComplete.
The available options are:
animate: Boolean
—Controls the popup animation. By default, the open and close animations are enabled.width: Number | String
—Sets the width of the popup container. By default, the width of the host element is used. If set toauto
, the component automatically adjusts the width of the popup and no item labels are wrapped. Theauto
mode is not supported when virtual scrolling is enabled.height: Number
—Sets the height of the popup container.popupClass: String
—Specifies a list of CSS classes that are used to style the popup.appendTo: "root" | "component" | ViewContainerRef
—Specifies the component to which the popup will be appended.
value
string
Sets the value of the AutoComplete.
virtual
boolean | VirtualizationSettings
Enables the virtualization functionality.
Fields
isOpen
boolean
Returns the current open state of the popup.
Events
close
EventEmitter<PreventableEvent>
Fires each time the popup is about to close. This event is preventable. If you cancel it, the popup will remain open.
filterChange
EventEmitter<string>
Fires each time the user types in the input field. You can filter the source based on the passed filtration value (see example).
blur
EventEmitter<any>
Fires each time the AutoComplete gets blurred.
focus
EventEmitter<any>
Fires each time the user focuses the AutoComplete.
open
EventEmitter<PreventableEvent>
Fires each time the popup is about to open. This event is preventable. If you cancel it, the popup will remain closed.
valueChange
EventEmitter<string>
Fires each time the value is changed—
when the component is blurred or the value is cleared through the Clear button
(see example).
When the value of the component is programmatically changed to ngModel
or formControl
through its API or form binding, the valueChange
event is not triggered because it
might cause a mix-up with the built-in valueChange
mechanisms of the ngModel
or formControl
bindings.
Methods
blur
Blurs the AutoComplete.
focus
Focuses the AutoComplete.
reset
Resets the value of the AutoComplete.
If you use the reset
method to clear the value of the component,
the model will not update automatically and the selectionChange
and valueChange
events will not be fired.
toggle
Toggles the visibility of the popup.
If you use the toggle
method to open or close the popup, the open
and close
events will not be fired.
Parameters
open?
boolean
The state of the popup.