[Vuejs]-Display Google Map only if geocoding of an address is successful

0๐Ÿ‘

โœ…

My code was right, but the scope of this line:

geocoder.geocode({'address': fullAddress }, function(response, status) {

was not allowing this.displayMap = true; to bind properly.

I changed it to:

geocoder.geocode({'address': fullAddress }, (response, status) => {

I also changed the template to use v-show instead of v-if so that the element stays in the DOM.

Works a charm now ๐Ÿ™‚

Leave a comment