微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

角度谷歌地图的缩放控制属性中出现此错误的原因是什么?

如何解决角度谷歌地图的缩放控制属性中出现此错误的原因是什么?

我正在尝试构建一个带有半径的简单谷歌地图位置标记

我正在使用 -

  • angular@11.0.4
  • angular-cli@11.0.4
  • agm/core@3.0.0

我在运行 ng serve 时在终端中收到一个错误,关于 zoomControl 属性和我在 *.component.ts 文件中定义的方法

以下是终端中显示错误

Error: src/app/Map/Map.component.html:19:16 - error TS2554: Expected 2 arguments,but got 1.

    19     (dragEnd)="markerDragEnd($event)"

    src/app/Map/Map.component.ts:41:16
    41   templateUrl: './Map.component.html',Error occurs in the template of component MapComponent.
    src/app/Map/Map.component.html:12:3 - error NG8002: Can't bind to 'AgmZoomControl' since it isn't a kNown property of 'agm-map'.
    1. If 'agm-map' is an Angular component and it has 'AgmZoomControl' input,then verify that it is part of this module.
    2. If 'agm-map' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
    3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.

    12   [zoomControl]="true"
        
    src/app/Map/Map.component.ts:41:16
    41   templateUrl: './Map.component.html',Error occurs in the template of component MapComponent.

markerDragEnd() 方法来自 *.component.ts 文件

markerDragEnd(m: any,$event: any) {
   this.location.marker.lat = m.coords.lat;
   this.location.marker.lng = m.coords.lng;
   this.findAddressByCoordinates();
}

使用 zoomControl 属性和 markerDragEnd() 方法的段。

<agm-map
  [(latitude)]="location.lat"
  [(longitude)]="location.lng"
  [(zoom)]="location.zoom"
  [disableDefaultUI]="true"
  [zoomControl]="true"
  [(fitBounds)]="location.viewport"
>
  <agm-marker
    [(latitude)]="location.marker.lat"
    [(longitude)]="location.marker.lng"
    [markerDraggable]="location.marker.draggable"
    (dragEnd)="markerDragEnd($event)"
  ></agm-marker>
</agm-map>

错误的原因是什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?