ngx-select-dropdown Custom Dropdown component for Angular 4+ with multiple and single selection options
- single select dropdown
- multi select dropdown
- search dropdown list
npm install ngx-select-dropdown
- import
SelectDropDownModuleinto your app.module;
import { SelectDropDownModule } from 'ngx-select-dropdown'
- add
SelectDropDownModuleto the imports of your NgModule:
@NgModule({
imports: [
...,
SelectDropDownModule
],
...
})
class YourModule { ... }
- include css styles in you
angular-cli.json.
"styles": [
"../node_modules/ngx-select-dropdown/dist/assets/style.css"
],
- use
<ngx-select-dropdown></ngx-select-dropdown>in your templates to add the custom dropdown in your view like below
<ngx-select-dropdown (change)="selectionChanged($event)" [multiple]="true" [(value)]="dataModel" [config]="config" [options]="dropdownOptions"></ngx-select-dropdown>
multiple: boolean-true/falsebeased if multiple selection required or notDefaults to false.options: Array- Array of string/objects that are to be the dropdown options.value: any- the model variable in which you want to save the selected options.config: Object- configuration object.
config = {
displayKey:"description", //if objects array passed which key to be displayed defaults to description
search:true //true/false for the search functionlity
}
value: any- array of selected optionschange: Event- change event when user changes the selected options
- v0.1.0
Added a change event so that user can attach a change event handler.
If multiselect the selected text will display first item and + count for eg. (Option 1 + 2 more) .
- v0.2.0
Angular 4 and above support.
Bug with search functionality fixed.
- v0.3.0
Support for Observable data source for options and async pipe.
IE bug with styling.
Few other minor bug fixes.
- v0.4.0
Use arrows keys and enter to select items from available options.
Case insensitive search.
Few other minor bug fixes.
Found a bug or an issue with this? Open a new issue here on GitHub.
Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.