ang2-autocomplete
Angular2 Auto Complete
Live DEMO
Plunker example: https://plnkr.co/edit/5zRD0fcOZHXEMOk4kupY?p=preview
Installation
To install this library, run:
$ npm install ang2-autocomplete --save
add map
and packages
to your systemjs.config.js
:
map = 'node_modules/ang2-autocomplete/dist';packages =
and then from your Angular AppModule
:
;; ; ;
Usage it in your code
attributes
source : array or string or object contains array, required. data source for dropdown listplaceholder : string, autocomplete input guide textlistFormatter : function variable name, custom list formatting function.e.g. 'myListFormatter', not 'myListFormatter()'path-to-array : string, e.g., data.myList, path to array data in http response or in object contains arraykey-name : string, key name of value with which we need to filter url-param : string, the name of parameter we need to pass in url-paramlabel-name : string, key name of text to show. default is valueonSelectionChange : callback function that is executed when a new dropdown is selected. e.g. (onSelectionChane)="onSelectionChane($event)"minCharLength : number, the number of character length to start filtering the given data
Note:
We are aborting the previous calls when we are using urls, so the calls will be fast. Currently we are working on the css part for auto complete. Now we have to do our own css for look and feel.