Hi im having a problem with storing the long lat result to the this.long and this.lat variables, when i store it there nothings being stored, it will only return ‘undefined’ can you please help me with this?
geoCode(){
var geocoder = new google.maps.Geocoder();
this.geocodeAddress(geocoder);
console.log(this.long);
}
geocodeAddress(geocoder) {
var address = this.place;
geocoder.geocode({‘address’: address}, function(results, status) {
if (status === ‘OK’) {
console.log(this.place);
this.lat = results[0].geometry.location.lat();
this.long = results[0].geometry.location.lng();
} else {
alert('Geocode was not successful for the following reason: ’ + status);
}
});
}