Native select
Native select element, for comparing features and behavior.
Bind to string[]
Bind to a simple string array as source.
Bind to number[]
Bind to a simple number array with a lot of items as source.
[source]="numberArray"Bind to boolean values
Set source to [true, false] to bind to boolean values. To format the values, use a formatter.
[source]="[true, false]"Bind to Enums
Pass an Enum reference as source to display the enum items. To format the values, use a formatter.
[source]="Sexuality"Bind to objects
Pass an object array as source.
[source]="personList1"Format items
To format the display of items in the select component, use "formatBy" input.
To format a value, you need a formatter.
There is a set of built-in formatters available, or you can create your own custom formatters.
- Field formatter
- Locale formatter
- Number formatter (soon)
- Currency formatter (soon)
Compare items:
When working with reference types (e.g., object arrays), you need to specify how to compare the source items with the selected value(s).
By default, the select component uses strict equality (===) to compare items. You can change this behavior using the compareBy input.
You can compare items by a specific field or by a custom function.
Custom value writer:
When user selects an item, the select component writes back the selected value to the bound variable.
Sometimes you want customize the value that is written back. This is useful when you want to bind the component to a specific property of an object instead of the whole object.
you can write back the selected value(s) by a specific field or by a custom function.
Bind to RemoteDataSource
This select is bound to a RemoteDataSource. A remote data source is a data source that retrieves data from a remote server (or any source that is resolved asynchronously).
Manipulating items
You can change(add/remove/replace) select items.
Multi select
A multi-select component allows the user to select multiple options from a list.
Filter
To filter the options in the select component, set filterable to true and provide a filter predicate.
You can pass the name of the property to filter by using the filterBy input or a custom filter function.
By default, the select component will filter item values using a default filter function.
Custom Item templates
You can customize the display of items in the select dropdown by using ng-template.
Disabled state
Disable the select by setting the disabled property to true.
Events
Handle valueChange event to react on value changes. Select an item and See the browser console log.