Getting coordinates of clicked location using google maps native


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
				.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 but it says Property ‘lat’ does not exist on type ‘typeof LatLng’.

It’s been over two years, but if you or anybody still needs an answer to this: you can get the LatLng object from the data returned from the subscribe function:

map.addEventListener(GoogleMapsEvent.MAP_CLICK).subscribe(latlng => {
    // the latlng variable contains the data
    let lat: any = data[0].lat
    let lng: any = data[0].lng