Giter Site home page Giter Site logo

typeahead's Introduction

typeahead Angular Module

Very barebone angular typeahead module. Creates an autocomplete for input fields

Install

Copy the typeahead.js and typeahead.css file into your project and add the following line with the correct path:

	<script src="/path/to/scripts/typeahead.js"></script>
	<script src="/path/to/scripts/typeahead.css"></script>

Alternatively, if you're using bower, you can add this to your component.json (or bower.json):

	"angular-typeahead-basic": "~0.0.1"

And add this to your HTML:

	<script src="components/angular-typeahead-basic/typeahead.js"></script>
	<script src="components/angular-typeahead-basic/typeahead.css"></script>

Note that the style is very minimal, it's up to you to make it fit your need.

Usage

	<typeahead>
		<ul>
				<li ng-repeat="value in autocompleteValues">{{value}}</li>
		</ul>
	</typeahead>

And don't forget to add the module to your application

	angular.module("myApp", ["typeahead"])

Every attribute that you add to the typeahead tag will be put to the input tag. Note that the default type for input is text, but it can be changed, for example <typeahead type="email">

Options

  • show-if-empty You can decide to keep the list visible when no input is entered by adding the show-if-empty attribute like this:

      	<typeahead type="email" show-if-empty>
    
  • empty-message You can customize the message to display if there is no results. Defaults to "No results found" Leave empty or set to "" to remove the message You can insert the search result like this:

      	<typeahead placeholder="Enter the name of a car manufacturer" ng-model="obj.name" empty-message="Never heard of a {{obj.name}} car">
    

Event

The Event "typeahead:input" will be sent when the input is selected, so you can register to the event this way (the demo includes that too):

	$scope.$on("typeahead:input", function(e, input) {...});

Demo

Try the (very simple) demo. How to run the demo? Simple...

	git clone [email protected]:standup75/typeahead.git
	cd typeahead
	npm install && bower install
	grunt server

This should open your browser at http://localhost:9000 where the demo now sits.

typeahead's People

Contributors

chrisconley avatar

Stargazers

 avatar

Watchers

 avatar  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.