Giter Site home page Giter Site logo

indabaui / allmighty-autocomplete Goto Github PK

View Code? Open in Web Editor NEW

This project forked from justgoscha/allmighty-autocomplete

0.0 6.0 0.0 358 KB

Simple to use autocomplete directive in a module for AngularJs!

License: MIT License

JavaScript 53.30% CSS 46.70%

allmighty-autocomplete's Introduction

allmighty-autocomplete

Simple to use autocomplete directive in a module for AngularJS! Supports arrow keys to traverse suggestions as well as mouse input. You can load the suggestions from a remote REST API, it also supports promises.

Install:

  component install indabaui/allmighty-autocomplete

In your main script file you should add it as dependency:

require("indabaui-allmighty-autocomplete")

var app = angular.module('app', ['ngAutocomplete']);

Usage

If you now want an autocomplete you can just use the tag <autocomplete> tag in your HTML. With the data parameter you can pass in an array on function that will be used for autocompletion. You need to pass there something which is available in the $scope of your controller.

Attributes

data : Pass an array or function that return an array to the autocomplete directive. Should be accessible in the $scope of your controller.

Example

HTML:

    <div ng-controller="MyCtrl">  
      <autocomplete data="movies">
      	<input type="text" ng-model="myModel">
      </autocomplete>
      <span>The model is still available in this scope: {{myModel}}</span>
    </div>

JavaScript:

	var app = angular.module('app', ['ngAutocomplete']);

	app.controller('MyCtrl', function($scope, MovieRetriever){
		$scope.movies = ["Lord of the Rings",
		 				"Drive",
		 				"Science of Sleep",
		 				"Back to the Future",
		 				"Oldboy"];
	});

allmighty-autocomplete's People

Contributors

justgoscha avatar peachscript avatar

Watchers

Eric Richmond avatar Peter Swan avatar Ethan Fuchs avatar James Cloos avatar Andreas Klein avatar Rick Louie avatar

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.