Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 2.39 KB

value-binding.md

File metadata and controls

57 lines (40 loc) · 2.39 KB
layout title description platform control documentation domainurl
post
Data binding in Angular Auto complete component | Syncfusion
Learn here all about Data binding in Syncfusion Angular Auto complete component of Syncfusion Essential JS 2 and more.
ej2-angular
Data binding
ug

Value binding in AutoComplete Component

Value binding in the AutoComplete control allows you to associate data values with each list item. This facilitates managing and retrieving selected values efficiently. The AutoComplete component provides flexibility in binding both primitive data types and complex objects.

Primitive Data Types

The AutoComplete control provides flexible binding capabilities for primitive data types like strings and numbers. You can effortlessly bind local primitive data arrays, fetch and bind data from remote sources, and even custom data binding to suit specific requirements. Bind the value of primitive data to the value property of the AutoComplete.

Primitive data types include:

  • String
  • Number
  • Boolean
  • Null

The following sample shows the example for preselect values for primitive data type

{% tabs %} {% highlight ts tabtitle="app.component.ts" %} {% include code-snippet/autocomplete/primitive/src/app.component.ts %} {% endhighlight %}

{% highlight ts tabtitle="main.ts" %} {% include code-snippet/autocomplete/primitive/src/main.ts %} {% endhighlight %} {% endtabs %}

{% previewsample "page.domainurl/samples/autocomplete/primitive" %}

Object Data Types

In the AutoComplete control, object binding allows you to bind to a dataset of objects. When allowObjectBinding is enabled, the value of the control will be an object of the same type as the selected item in the value property. This feature seamlessly binds arrays of objects, whether sourced locally, retrieved from remote endpoints, or customized to suit specific application needs.

The following sample shows the example for preselect values for object data type

{% tabs %} {% highlight ts tabtitle="app.component.ts" %} {% include code-snippet/autocomplete/object/src/app.component.ts %} {% endhighlight %}

{% highlight ts tabtitle="main.ts" %} {% include code-snippet/autocomplete/object/src/main.ts %} {% endhighlight %} {% endtabs %}

{% previewsample "page.domainurl/samples/autocomplete/object" %}