【发布时间】:2021-01-04 22:09:27
【问题描述】:
我在应用程序地图信息窗口初始化时遇到错误。 我希望应用程序加载地图并自动显示标记信息,而无需用户点击标记。
我正在使用 agm/core@^1.0.0
这是我显示信息窗口的代码。
<agm-map
[latitude]="latitude"
[longitude]="longitude"
[zoom]="zoom"
(mapClick)="onSetMarker($event)"
[streetViewControl]="false"
[disableDefaultUI]="false"
[zoomControl]="false">
<agm-marker
[latitude]="latitude"
[longitude]="longitude"
[markerDraggable]="true"
[animation]="'BOUNCE'"
[markerClickable]="true"
(dragEnd)="markerDragEnd($event)"
[openInfoWindow]="true"
[iconUrl]="iconUrl"
class="mapMarker">
<agm-info-window [isOpen]="true">
<strong>
{{address}}
</strong>
</agm-info-window>
</agm-marker>
</agm-map>
这是我在应用程序加载但无法显示信息窗口时遇到的错误。
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined
TypeError: Cannot read property 'then' of undefined
at VM225815 vendor.js:1363
at ZoneDelegate.invoke (VM225810 polyfills.js:3470)
at Object.onInvoke (VM225815 vendor.js:69538)
at ZoneDelegate.invoke (VM225810 polyfills.js:3469)
at Zone.run (VM225810 polyfills.js:3229)
at VM225810 polyfills.js:3963
at ZoneDelegate.invokeTask (VM225810 polyfills.js:3505)
at Object.onInvokeTask (VM225815 vendor.js:69526)
at ZoneDelegate.invokeTask (VM225810 polyfills.js:3504)
at Zone.runTask (VM225810 polyfills.js:3273)
at resolvePromise (VM225810 polyfills.js:3904)
at VM225810 polyfills.js:3970
at ZoneDelegate.invokeTask (VM225810 polyfills.js:3505)
at Object.onInvokeTask (VM225815 vendor.js:69526)
at ZoneDelegate.invokeTask (VM225810 polyfills.js:3504)
at Zone.runTask (VM225810 polyfills.js:3273)
at drainMicroTaskQueue (VM225810 polyfills.js:3675)
当我点击突出显示的文件链接时,我会在下面看到这段代码。
open(infoWindow) {
return this._infoWindows.get(infoWindow).then((w)=>{
if (infoWindow.hostMarker != null) {
return this._markerManager.getNativeMarker(infoWindow.hostMarker).then((marker)=>{
return this._mapsWrapper.getNativeMap().then((map)=>w.open(map, marker));
}
);
}
return this._mapsWrapper.getNativeMap().then((map)=>w.open(map));
}
);
}
【问题讨论】:
标签: angular google-maps ionic-framework agm-core