1.0.5 • Published 7 years ago

ngx-select-options v1.0.5

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

ngx-select-options

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.

How to install

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,
    ...
]

How to use in code

Instead of default select input use code down below

<ngx-select-options placeholder="Select option" [(ngModel)]="valueModel" [options]="options" ngDefaultControl></ngx-select-options>
ParameterDescription
placeholderText displayed on dropdown button
ngModelAngular data binding
optionsArray of options in dropdown

Array options structure

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).