The "coords" property does not exist in the "MouseEvent" type. In Angular2 marker event -google-maps

I added the mapClicked map event to angular2 -google-maps. The code is as follows:

mapClicked($event: MouseEvent) {
this.markers.push({
  lat: $event.coords.lat,
  lng: $event.coords.lng,
  draggable: false
});

}

I get a compile-time error while serving my ion 2 application with an "ion feed".

Thanks in advance, AB

+4
source share
2 answers

Typescript , MouseEvent coords, angular2-google-maps, , coords (ng2 google maps MouseEvent interface), any MouseEvent :

mapClicked($event: any) {
this.markers.push({
  lat: $event.coords.lat,
  lng: $event.coords.lng,
  draggable: false
});

, @Bruno Garcia, AGM. , IDE MouseEvent.

MouseEvent, , , , MouseEvent :

import { MouseEvent as AGMMouseEvent } from '@agm/core';

:

mapClicked($event: AGMMouseEvent) { ... }
+10

, , MouseEvent coords.

AGM MouseEvent, , , coords LatLngLiteral. :

import {MouseEvent} from "@agm/core";

TypeScript , ​​ $event.

+3

Source: https://habr.com/ru/post/1670808/


All Articles