Skip to content

Instantly share code, notes, and snippets.

@hfogelberg
Last active June 16, 2020 15:47
Show Gist options
  • Select an option

  • Save hfogelberg/dbefea340cecb60086bbf3d4ec56c4c4 to your computer and use it in GitHub Desktop.

Select an option

Save hfogelberg/dbefea340cecb60086bbf3d4ec56c4c4 to your computer and use it in GitHub Desktop.
this.autocomplete.addListener('place_changed', () => {
let place = this.autocomplete.getPlace();
let ac = place.address_components;
let lat = place.geometry.location.lat();
let lon = place.geometry.location.lng();
let city = ac[0]["short_name"];
console.log(`The user picked ${city} with the coordinates ${lat}, ${lon}`);
});
@johnkyony
Copy link

Thank you so much for this tutorial, I would like to know where do I insert this piece of code. in the methods, or in the mounted()

@dcandamil
Copy link

in mounted()

@bhavinjr
Copy link

is there any better way to manage with multiple fields (Like. Add more/Remove field)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment