Cant fetch latitude and longitude


#1

I am unable to fetch the latitude and longititude value to title.
i am trying to get the longitude and latitude of the title which is nothing but a string value of any place on google maps.
but, as you might see in the code i have given an alert msg to print values to lat and lng but they are coming out as undefined.

and then i want to project these values to a map to show the place on it.

can anyone suggest me a solution to this why it is not working me.

onLocateUser(title)
{
console.log(title); // is printing the string of place means value is coming
this.nativegeocoder.forwardGeocode(title).then((coordinates: NativeGeocoderForwardResult) => {
alert('The coordinates are= '+ coordinates.latitude + ’ and latitude= '+coordinates.longitude)
this.location.lat = coordinates.latitude;
this.location.lng = coordinates.longitude;

  // console.log(this.location.lat+  " " +this.location.lng);
})
.catch((error: any) => {
  alert("error msg: " + error);
})

}