ngAutocomplete

Simple AngulasJS directive for adding google places autocomplete to a textbox element
Homepage:
69 people use it
Author: 93f16366dfb9f703198437f509e96fe0?d=https%3a%2f%2fidenticons.github.com%2fc0947d659f8feac10b8f7e69e3f3b138 wpalahnuk

ng-Autocomplete

A simple directive for adding google places autocomplete to a textbox element

Examples

Usage

Include the required libraries html <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>

Declare a dependency on the ng-Autocomplete module javascript var app = angular.module('myModule', ['ng-Autocomplete']);

Add the directive to a textbox

Documentation

  • result - autocomplete textbox value

  • details - more detailed autocomplete result, includes address parts, latlng, etc.

  • options - configuration for the autocomplete

    • types: type, string, values can be 'geocode', 'establishment', '(regions)', or '(cities)'
    • bounds: bounds, google maps LatLngBounds Object, biases results to bounds, but may return results outside these bounds
    • country: country string, ISO 3166-1 Alpha-2 compatible country code. examples; 'ca', 'us', 'gb'

example: javascript options = { types: '(cities)' country: 'ca' }

google places autocomplete info: https://developers.google.com/maps/documentation/javascript/places

Author

Will Palahnuk (http://github.com/wpalahnuk)

Credits

google places autocomplete https://developers.google.com/maps/documentation/javascript/places

comments powered by Disqus
This page was last updated almost 4 years ago.