JSPM

  • Created
  • Published
  • Downloads 725
  • Score
    100M100P100Q116051F
  • License MIT

Angular2 Input Autocomplete

Package Exports

  • ng2-auto-complete
  • ng2-auto-complete/dist
  • ng2-auto-complete/dist/index

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ng2-auto-complete) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ng2-auto-complete

Angular2 Auto Complete

Install

  1. install ng2-auto-complete

     $ npm install ng2-auto-complete --save
  2. add map and packages to your systemjs.config.js

     map['auto-complete'] = 'node_modules/ng2-auto-complete';
     // map['auto-complete'] = 'https://npmcdn.com/ng2-auto-complete'; // without npm installation
     packages['auto-complete'] = { main: 'dist/index.js', defaultExtension: 'js' }

Usage it in your code

  1. import and add directive in your component

     import {AutoCompleteDirective} from "auto-complete";
     ...
     @Component({
       directives: [AutoCompleteDirective],
       ..
     });
  2. You are ready. use it in your template

     <input auto-complete [(ngModel)]="myData" [source]="mySource" />

attributes

All options are optional except ngModel and source

  • ngModel, any, variable that autocomplete result is assigned to
  • source, array or string, required. data source for dropdown list
  • placeholder, string, input guide text
  • list-formatter, function, custom list formatting functio
  • value-changed, function, callback function that is executed when dropdown is selected
  • path-to-data, string, e.g., data.myList, path to array data in http response
  • min-chars, number, when source is remote data, the number of character to see dropdown list
  • value-property-name, string, key name of value. default is id
  • display-property-name, string, key name of text to show. default is value