Code Monkey home page Code Monkey logo

angular-autocomplete's Introduction

angular-autocomplete

Autocomplete Directive for AngularJS

Angular Autocomplete was built with simplicity in mind assign ac-items="" attribute to a simple json array of strings or objects. If it is an array of objects specify which attribute in the object contains the autocomplete string you would like to match with ac-term="". If you are just using an array of strings do not add this attribute. Create a function to call on key up to update the item in your $scope you would like to update, along with having the ability to update any of the scope attributes you would like. Lastly add a placeholder for placeholding text before you start to use autocomplete.

View Demo: https://jonnysowards.github.io/angular-autocomplete/

Usage:

<script>
    angular.module('exampleApp',
            [
                "angularAutocomplete"
            ]
    ).controller('exampleObjectController', function($scope) {
        $scope.items = [
            {partNum: "Q5950A"},
            {partNum: "Q5951A"},
            {partNum: "Q5952A"},
        ];

        $scope.updateObjectItems = function(typedString){
            console.log(typedString);
            //You can run a service here to update $scope.items with a query using typedString
        }
    });
</script>

<div ng-controller="exampleObjectController">
    <ng-autocomplete ac-items="items" ac-term="'partNum'" ac-keyup="updateObjectItems" placeholder="Part Number..." ng-model="partToSelectObject"></ng-autocomplete>
    Selected Item: {{partToSelectObject}}
</div>

angular-autocomplete's People

Contributors

jonnysowards avatar

Stargazers

Fernando Contreras avatar Hardik Sondagar avatar Zeno Zaplaic avatar  avatar Tina avatar Christoph Klocker avatar

Watchers

 avatar James Cloos avatar

angular-autocomplete's Issues

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.