1

这是我的代码,但它不起作用。当我单击地图时,它显示错误:无法读取未定义的属性“纬度”

 <agm-map
          style="height: 700px"
          [latitude]="lat"
          [longitude]="lng"
          [zoom]="zoom"
          (mapClick)="placeMarker($event)"
        >

Ts file


placeMarker($event) {
    console.log($event.coords.lat);
    console.log($event.coords.lng);
  }```
4

1 回答 1

1

请参考这个例子,

https://www.freakyjolly.com/angular-google-maps-using-agm-core/#.X3L25nUzY5k

有一个很好的例子可以理解关于 AGM 也可以参考下面的例子

https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html

于 2020-09-29T08:58:46.797 回答