This is a library based on a fork from ng2-select. We would love any PRs if you have enhancements in mind. We intend on maintaining this library for a while and in the event that our organization does not need this library anymore and/or we become too busy to maintain it we are open to adding other co-maintainers.
- A recommended way to install ng-next-select is through npm package manager using the following command:
npm i ng-next-select --save
- Include
ng-next-select.css
in your project
items
- (Array<any>
) - Array of items from which to select. Should be an array of objects withid
andtext
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. Items may be nested by adding achildren
property to any item, whose value should be another array of items. Items that have children may omit having an ID. Ifitems
are specified, all items are expected to be available locally and all selection operations operate on this local array only. If omitted, items are not available locally, and thequery
option should be provided to fetch data.active
(?Array<any>
) - selection data to set. This should be an object withid
andtext
properties in the case of input type 'Single', or an array of such objects otherwise. This option is mutually exclusive with value.allowClear
(?boolean=false
) (not yet supported) - Set totrue
to allow the selection to be cleared. This option only applies to single-value inputs.placeholder
(?string=''
) - Placeholder text to display when the element has no focus and selected items.disabled
(?boolean=false
) - Whentrue
, it specifies that the component should be disabled.multiple
- (?boolean=false
) - Mode of this component. If settrue
user can select more than one option. This option only applies to single-value inputs, as multiple-value inputs don't have the search input in the dropdown to begin with.
data
- it fires during all events of this component; returnsArray<any>
- current selected dataselected
- it fires after a new option selected; returns object withid
andtext
properties that describes a new option.removed
- it fires after an option removed; returns object withid
andtext
properties that describes a removed option.typed
- it fires after changing of search input; returnsstring
with that value.
Please follow this guidelines when reporting bugs and feature requests:
- Use GitHub Issues board to report bugs and feature requests (not our email address)
- Please always write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.
Thanks for understanding!
- Import our library in your package.json instead of ng2-select
- Rename ng2-select.css to ng-next-select.css
That's it
The MIT License (see the LICENSE file for the full text)