下午好,我是angular 8和AGM地图的新手,我正试图在地图上生成一个圆圈,但当我执行它时,我得到了以下结果
ERROR TypeError: Cannot read property 'then' of undefined
at Observable._subscribe (agm-core.js:292)
at Observable._trySubscribe (Observable.js:42)
at Observable.subscribe (Observable.js:28)
at agm-core.js:1499
at Map.forEach (<anonymous>)
at AgmCircle._registerEventListeners (agm-core.js:1498)
at AgmCircle.ngOnInit (agm-core.js:1449)
at checkAndUpdateDirectiveInline (core.js:31910)
at checkAndUpdateNodeInline (core.js:44367)
at checkAndUpdateNode (core.js:44306)我的代码如下
<mat-card-content class="text-justify ">
<agm-map [latitude]=" contri.latitude " [longitude]=" contri.longitude " [zoom]="mapzoom ">
<agm-circle [latitude]="40.7127753" [longitude]="-74.0059728" [clickable]="false" [draggable]="true" [editable]="false" [fillColor]="green" [fillOpacity]="0" [radius]="175.61"> </agm-circle>
</agm-map>
</mat-card-content>在app.module.js中,我有以下导入
imports: [
AgmCoreModule.forRoot({
apiKey: 'AIzZZaassdqws4aaa',
libraries: ["places", "geometry"]
})有人收到了这个错误,或者知道是什么导致的
发布于 2021-02-19 05:57:37
一个临时的解决方案是降级到"@agm/core":"1.1.0“
这对我很有效
实际的版本是3.0.0测试版,它是预发布的,所以这意味着它不是一个稳定的版本
我从这个插入器https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html中获取了示例package.json
查看releases https://github.com/SebastianM/angular-google-maps/releases
https://stackoverflow.com/questions/63874268
复制相似问题