0

I have a map and a mapClick event and I'm trying to get coordinates.

ts file

onMapClick(event) {
        console.log(event);
    }

html file

<agm-map (mapClick)="onMapClick($event)" [latitude]="latitude" [longitude]="latitude"
                         [zoom]="13">
    <agm-marker [latitude]="latitude" [longitude]="latitude"></agm-marker>
</agm-map>

But the console returns c instead of coordinates. I have the same code in another project (Angular) and it works as expected.

golgo13
  • 15
  • 2
  • 4
  • Check out https://stackoverflow.com/questions/44887015/angular-2-google-maps-get-coordinates-from-click-position-on-map-to-update-mark – Onur Baştürk Nov 03 '20 at 20:01
  • I have already tried that and it prints "core.js:6228 ERROR TypeError: Cannot read property 'lat' of undefined". It doesn't apply on Ionic for whatever reason. – golgo13 Nov 04 '20 at 07:36

1 Answers1

0

I checked the @agm/core version and it was the 3.0.0-beta.0 so I tried to go back to the previous version 1.1.0 and now it works as expected.

MaartenDev
  • 5,631
  • 5
  • 21
  • 33
golgo13
  • 15
  • 2
  • 4