A Google Places Autocomplete plugin for Aurelia.
npm install aurelia-google-placesplaced_changed event. Simply bind a value to the element to get the value of the input in your form. The downside is that you still need to do your own geocoding if you want to have geographic coordinates of the address. Luckily, this can be easily done with the Google Geocoder.
shell
npm install aurelia-google-places --save
`
JSPM
`shell
jspm install aurelia-google-places
`
Bower
`shell
bower install aurelia-google-places
`
Configuration
Add to package.json
`json
"aurelia": {
"build": {
"resources": [
"aurelia-google-places"
]
}
}
`
Inside of your main.js or main.ts file simply load the plugin inside of the configure method using .plugin().
`javascript
export async function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.use
.plugin('aurelia-google-places', config => {
config.options({
apiScriptLoadedEvent: 'aurelia-plugins:google-maps:api-script-loaded', // if loadApiScript is false, the event that is subscribed to to know when the Google Maps API is loaded by another plugin
key: '', // your Google API key retrieved from the Google Developer Console
language: 'es', // see https://developers.google.com/maps/documentation/javascript/localization
libraries: 'places', // see https://developers.google.com/maps/documentation/javascript/libraries
loadApiScript: true|false, // whether or not the