i try to displaying data Reverse geocoding but no data display
here code i try :
…
eventMessage ;
testposition ;
const div = document.getElementById("mapTest");
let map = plugin.google.maps.Map.getMap(div, {
controls: {
myLocationButton: true,
myLocation: true,
compass: true,
} );
map.addEventListener(plugin.google.maps.event.MAP_READY, () => {
map.on(plugin.google.maps.event.CAMERA_MOVE_START, this.cekevent);
map.on(plugin.google.maps.event.CAMERA_MOVE, this.cekevent);
map.on(plugin.google.maps.event.CAMERA_MOVE_END, this.onCameraEvents);
});
cekevent(){
let message ="cek event touched" ;
this.eventMessage = message ;
}
onCameraEvents( cameraPosition){
let fields = {
"lat": document.getElementById("lat"),
"lng": document.getElementById("lng"),
"zoom": document.getElementById("zoom"),
"tilt": document.getElementById("tilt"),
"bearing": document.getElementById("bearing")
};
fields.lat.innerText = cameraPosition.target.lat;
fields.lng.innerText = cameraPosition.target.lng;
fields.zoom.innerText = cameraPosition.zoom;
fields.tilt.innerText = cameraPosition.tilt;
fields.bearing.innerText = cameraPosition.bearing;
this.testposition = cameraPosition.target.lat +','+ cameraPosition.target.lng ;
this.searchLocation(this.testposition);
}
searchLocation(latLng){
plugin.google.maps.Geocoder.geocode({
"position": latLng
}, (results) => {
if (results.length === 0) {
// Not found
return;
}
// results code will be here
});
}
in HTML {{ eventMessage }} and {{ testposition }} blank , i try to put setTimeout but no luck,
ionic info ;
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.8
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.9.2
plugin : “cordova-plugin-googlemaps”: “^2.2.5”,