chooseItem(item: any) {
this.address = item;
let data = this.geocodeAddress();
console.log(data);
//how to get or console lat value;
//how to get or console lng value;
}
geocodeAddress(){
var loc= [];
this.geocoder.geocode({‘address’: this.address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
loc[‘lat’] = results[0].geometry.location.lat();
loc[‘lng’] = results[0].geometry.location.lng();
} else {
console.log('Geocoder failed due to: ’ + status);
}
});
return loc;
}
sorry for the trouble but I have been working on this for several hours but could do it right. Now the code does not find lat and lng it says property lat does not exit