Installations
npm install ng-multiselect-dropdown
Developer Guide
Typescript
No
Module System
ESM
Node Version
16.20.1
NPM Version
8.19.4
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (70.83%)
SCSS (15.98%)
HTML (10.75%)
JavaScript (2.43%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
13,368,696
Last Day
304
Last Week
304
Last Month
197,757
Last Year
3,159,478
GitHub Statistics
329 Stars
120 Commits
291 Forks
16 Watching
20 Branches
20 Contributors
Package Meta Information
Latest Version
1.0.0
Package Id
ng-multiselect-dropdown@1.0.0
Unpacked Size
166.68 kB
Size
38.48 kB
File Count
19
NPM Version
8.19.4
Node Version
16.20.1
Publised On
28 Jul 2023
Total Downloads
Cumulative downloads
Total Downloads
13,368,696
Last day
0%
304
Compared to previous day
Last week
-99.3%
304
Compared to previous week
Last month
-13.4%
197,757
Compared to previous month
Last year
2.8%
3,159,478
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Angular Multiselect Dropdown
Angular multiselect dropdown component for web applications. Easy to integrate and use. It can be bind to any custom data source.
Demo
Getting Started
Features
- dropdown with single/multiple selction option
- bind to any custom data source
- search item with custom placeholder text
- limit selection
- select/de-select all items
- custom theme
Installation
npm install ng-multiselect-dropdown
And then include it in your module (see app.module.ts):
1import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown'; 2// ... 3 4@NgModule({ 5 imports: [ 6 NgMultiSelectDropDownModule.forRoot() 7 // ... 8 ] 9 // ... 10}) 11export class AppModule {}
Usage
1import { Component, OnInit } from '@angular/core'; 2import { IDropdownSettings } from 'ng-multiselect-dropdown'; 3 4export class AppComponent implements OnInit { 5 dropdownList = []; 6 selectedItems = []; 7 dropdownSettings = {}; 8 ngOnInit() { 9 this.dropdownList = [ 10 { item_id: 1, item_text: 'Mumbai' }, 11 { item_id: 2, item_text: 'Bangaluru' }, 12 { item_id: 3, item_text: 'Pune' }, 13 { item_id: 4, item_text: 'Navsari' }, 14 { item_id: 5, item_text: 'New Delhi' } 15 ]; 16 this.selectedItems = [ 17 { item_id: 3, item_text: 'Pune' }, 18 { item_id: 4, item_text: 'Navsari' } 19 ]; 20 this.dropdownSettings:IDropdownSettings = { 21 singleSelection: false, 22 idField: 'item_id', 23 textField: 'item_text', 24 selectAllText: 'Select All', 25 unSelectAllText: 'UnSelect All', 26 itemsShowLimit: 3, 27 allowSearchFilter: true 28 }; 29 } 30 onItemSelect(item: any) { 31 console.log(item); 32 } 33 onSelectAll(items: any) { 34 console.log(items); 35 } 36}
1<ng-multiselect-dropdown 2 [placeholder]="'custom placeholder'" 3 [settings]="dropdownSettings" 4 [data]="dropdownList" 5 [(ngModel)]="selectedItems" 6 (onSelect)="onItemSelect($event)" 7 (onSelectAll)="onSelectAll($event)" 8> 9</ng-multiselect-dropdown>
Settings
Setting | Type | Description | Default Value |
---|---|---|---|
singleSelection | Boolean | Mode of this component. If set true user can select more than one option. | false |
placeholder | String | Text to be show in the dropdown, when no items are selected. | 'Select' |
disabled | Boolean | Disable the dropdown | false |
data | Array | Array of items from which to select. Should be an array of objects with id and text properties. You can also use custom properties. In that case you need to map idField and textField properties. As convenience, you may also pass an array of strings, in which case the same string is used for both the ID and the text(no mapping is required) | n/a |
idField | String | map id field in case of custom array of object | 'id' |
textField | String | map text field in case of custom array of object | 'text' |
enableCheckAll | Boolean | Enable the option to select all items in list | false |
selectAllText | String | Text to display as the label of select all option | Select All |
unSelectAllText | String | Text to display as the label of unSelect option | UnSelect All |
allowSearchFilter | Boolean | Enable filter option for the list. | false |
searchPlaceholderText | String | custom search placeholder | Search |
clearSearchFilter | Boolean | clear search filter on dropdown close | true |
maxHeight | Number | Set maximum height of the dropdown list in px. | 197 |
itemsShowLimit | Number | Limit the number of items to show in the input field. If not set will show all selected. | All |
limitSelection | Number | Limit the selection of number of items from the dropdown list. Once the limit is reached, all unselected items gets disabled. | none |
searchPlaceholderText | String | Custom text for the search placeholder text. Default value would be 'Search' | 'Search' |
noDataAvailablePlaceholderText | String | Custom text when no data is available. | 'No data available' |
closeDropDownOnSelection | Boolean | Closes the dropdown when item is selected. applicable only in cas of single selection | false |
defaultOpen | Boolean | open state of dropdown | false |
allowRemoteDataSearch | Boolean | allow search remote api if no data is present. | false |
Callback Methods
onSelect
- Return the selected item when an item is checked. Example : (onSelect)="onItemSelect($event)"onSelectAll
- Return the all items. Example : (onSelectAll)="onSelectAll($event)".onDeSelect
- Return the unselected item when an item is unchecked. Example : (onDeSelect)="onItemDeSelect($event)"onFilterChange
- Return the key press. Example : (onFilterChange)="onFilterChange($event)"onDropDownClose
- Example : (onDropDownClose)="onDropDownClose()"
Custom Theme
- The component package has a themes folder in node_modules at
ng-multiselet-dropdown\themes\ng-multiselect-dropdown.theme.scss
- Include the
ng-multiselet-dropdown.theme.css
inangular-cli.json
(for versions below angular 6) andangular.json
(for version 6 or more). - Refer this file on how to add the css file to your angular project.
Custom Template(in beta):
Variables can be used in template
- id: return id as number
- option: return option text. return string
- isSelected: determine if item is selected or not. returns boolean
Template for each item
<ng-template #optionsTemplate let-item let-option="option" let-id="id" let-isSelected="isSelected">
{{option}}
</ng-template>
Template for selected item
<ng-template #optionSelectedTemplate optionSelectedTemplate let-option="option" let-id="id">
{{option}}
</ng-template>
Run locally
- Clone the repository or downlod the .zip,.tar files.
- Run
npm install
- Run
ng serve
for a dev server - Navigate to
http://localhost:4200/
Library Build / NPM Package
Run yarn build:lib
to build the library and generate an NPM package. The build artifacts will be stored in the dist-lib/ folder.
Running unit tests
Run yarn test
to execute the unit tests.
Development
This project was generated with Angular CLI version 1.7.1.
Contributions
Contributions are welcome, please open an issue and preferrably file a pull request.
Opening Issue
Please share sample code using codesandbox.com or stackblitz.com to help me re-produce the issue.
License
MIT License.
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Tom Saleeba 💻 | Simon Pinfold 💻 | Sushil Suthar 💻 | Sachin Grover 💻 | Mike Roberts 💻 | David Sosa 💻 | Sergiy Gedeon 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/NileshPatel17/ng-multiselect-dropdown/nodejs.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/NileshPatel17/ng-multiselect-dropdown/nodejs.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:22
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
- Warn: branch protection not enabled for branch 'beta'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to ng-multiselect-dropdown
@ng-select/ng-select
Angular ng-select - All in One UI Select, Multiselect and Autocomplete
@syncfusion/ej2-angular-dropdowns
Essential JS 2 DropDown Components for Angular
search-multiselect-dropdown
A Angular(8+) Search And Multiselection Dropdown.
ng-multiselect-dropdown-infinite-scroll
Angular Multi-Select Dropdown with Scroll Bottom Detection