Easy to use Angular >= 2 module that replaces default HTML select input with more advended dropdown - combobox style. Features options search. Works perfectly with Angular ngModel directive.
Install package with npm
npm install ngx-select-options --save
Import in your module file:
import {NgxSelectOptions} from 'ngx-select-options'
And then include this module in import section in @NgModule
imports: [
NgxSelectOptions,
...
]
Instead of default select input use code down below
<ngx-select-options placeholder="Select option" [(ngModel)]="valueModel" [options]="options" ngDefaultControl></ngx-select-options>
Parameter | Description |
---|---|
placeholder | Text displayed on dropdown button |
ngModel | Angular data binding |
options | Array of options in dropdown |
Options data displayed on dropdown shoud have structure like this:
[
{
label: 'Option label',
value: 123
},
{...}
]
Optional you can use also key
value that defines selected value on dropdown button (instead of placeholder, when value is already selected).