0.0.10 • Published 8 years ago

aurelia-place-picker v0.0.10

Weekly downloads
2
License
CC0-1.0
Repository
github
Last release
8 years ago

Aurelia-place-picker

This aurelia plugin is a wrapper around the google.maps.places.autocomplete. It renders a searchbox and returns an object with the placename, latitude and longitude coordinates

See the example: here; The inspiration: here;

Installation

jspm install npm:aurelia-place-picker

Or for webpack:

npm install aurelia-place-picker

Usage

In your main.js:

.plugin('aurelia-place-picker', config => {
      config.options({
      apiKey: '[YOUR API KEY HERE]',          //Required
      getAPI: true,                           //Optional, see 'Problems'
      apiLoadedEvent: 'googlemap:api:loaded'  //Optional, see 'Problems'
    });

Then in your HTML:

<place-picker location.bind="location"></place-picker>

And finally the CSS:

.aurelia-place-picker{
 [YOUR STYLE HERE]
}

It returns an object:

location = {
  name: 'location name',
  lat: '12.3456',
  lng: '98.7654'
}

And fires an event:

  • placePicker:place_changed with the location object as payload.

Problems

If you try to use this together with the aurelia-google-maps plugin, you'll get an error:

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

If this is the case, you need to set the getAPI property to false and have to set a name for the apiLoadedEvent. At the time of writing, the aurelia-google-maps plugin will not fire an event, so this will not work. I suggest you go to My Fork and overwrite the dist folder in you node_modules. Let's hope my pull request will get merged soon.

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago