in fallowing code I want to pass dragged marker LatLng into a function to get address but it is not working
public LastLat : any;
public LastLng : any;
. . .
lastLatLng(marker){
google.maps.event.addListener(marker, 'dragend', function() {
this.LastLat= marker.position.lat();
this.LastLng= marker.position.lng();
});
console.log(this.LastLat,this.LastLng);
this.Getaddress(this.LastLat,this.LastLng);
}
Getaddress(LastLat, LastLng){
this.http.get('http://nominatim.openstreetmap.org/reverse?format=json&lat='+LastLat+ '&lon='+LastLng + '&zoom=18&addressdetails=1')
.map(res => res.json())
.subscribe(data => {
this.data = data.display_name;
console.log(this.data);
});
}