Fork me on GitHub

Google Places Autocomplete

Dependency-free, IE8+, small footprint, easily customizable

Install and Usage

Gplaces is installable via npm and bower.

npm install -S gplaces
-- or
bower -S install gplaces

Using gplaces with node.js and browserify is super easy.

First, setup your proxy. Here's how to do it in Express:

// Setup your path anywhere you'd like
app.get('/api/gplaces'
, require('gplaces').proxy({
    // Make sure you get an API key Places Autocomplete
    // https://code.google.com/apis/console
    key: 'MY_GOOGLE_API_KEY'
  })
);

Next up, in your client-side build file, configure gplaces.http to point to your proxy. We'll be using jquery's getJSON method in this example

var gplaces = require('gplaces');

// You must tell gplaces how to make the request to your
// proxied API
gplaces.http( function( input, callback ){
  $.getJSON( '/api/gplaces?input=' + input )
    .error( callback )
    .success( callback.bind( null, null ) );
});

Examples

Gplaces comes with a few variants you can play around with.

Default

Dark

Flip

Flip + Dark

Bouncy