Getting coordinates of clicked location using google maps native


#1

Hello,

Im trying to add markers dynamically. What I want to do is add an marker, every time the user clicks on map. The marker will be added to the clicked position.

map.addEventListener(GoogleMapsEvent.MAP_CLICK).subscribe(() =>
			{
			        let ionic: LatLng = new LatLng(GETLAT,GETLNG);
				let position: CameraPosition = {
				target: ionic,
				zoom: 18,
				tilt: 30
				};
				let markerOptions: MarkerOptions = {
				 position: ionic,
				 title: 'Your Location'
		 	    	'draggable': true
				};
				map.addMarker(markerOptions)
				.then((marker: Marker) => {
				});

			});

The problem is in: let ionic: LatLng = new LatLng(GETLAT,GETLNG); I don’t know how to get lat and get lng of the clicked place. I have tried to use LatLng.lat() but it says Property ‘lat’ does not exist on type ‘typeof LatLng’.