An auto-suggest/auto-complete widget for CanJS that can be loaded by:
StealJS + ES6
npm / Browserify / CJS
RequireJS / AMD
Standalone
It searches a model on a specified key and renders the results as a list below the search field. The search itself is debounced and delayed. By default, it will wait for 3 characters before doing a search and will then wait 250 milliseconds between keystrokes before doing another search.
Install
npm install bit-autocomplete --save
Usage
bit-autocomplete only requires a search model object passed to it. It assumes that it will need to search the label property of objects, so it will pass something like { label: "apple"} to the findAll method of the model. This can be changed during instantiation of the component by specifying the search-key attribute.
If a selection needs to be monitored, live-bind to the validated property.
Once the user selects an item from the results list, it will be available as the selectedItem property of the viewModel and the search field is updated with the selected item's value.
Install
ES6
With StealJS, you can import this module directly in a template that is autorendered: