Code Monkey home page Code Monkey logo

ng2-auto-complete's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.