Created
April 16, 2019 15:25
-
-
Save DanielSmith/0200176c4cf371771b6e785a7e191ac3 to your computer and use it in GitHub Desktop.
Get autocomplete address and broadcast it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initMapAutocomplete() { | |
this.geocoder = new google.maps.Geocoder(); | |
const input = document.getElementById('pac-input'); | |
const autocomplete = new google.maps.places.Autocomplete(input); | |
google.maps.event.addListener(autocomplete, 'place_changed', () => { | |
const place = autocomplete.getPlace(); | |
// we need to update the map | |
eventBus.$emit('newTextAddress', place); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment