gpt4 book ai didi

angular - agm-marker onMouseOver 打开 agm-info-window

转载 作者:太空狗 更新时间:2023-10-29 17:17:10 24 4
gpt4 key购买 nike

我使用 Angular Google Maps(AGM)组件。我需要在标记鼠标悬停时打开信息窗口。如何在我的函数 onMouseOver 中检索 infowindow 实例以将其打开?

<agm-map [fitBounds]="latlngBounds" [zoom]="15">
<agm-marker *ngFor="let m of markers; let i = index"
[latitude]="m.geoCode.latitude"
[longitude]="m.geoCode.longitude"
(mouseOver)="onMouseOver(m)"
>

<agm-info-window [disableAutoPan]="false">

<div>
<a (click)="onClickInfoView({id:m.id})" class="btn btn-attention pull-right">test<i class="fa fa-angle-double-right"></i></a>
</div>

</agm-info-window>


</agm-marker>

</agm-map>



onMouseOver(data) {
???? /* how to open here the info window?
}

最佳答案

最后我找到了解决办法:

<agm-map #gm [fitBounds]="latlngBounds" [zoom]="15">
<agm-marker *ngFor="let m of markers; let i = index"
[latitude]="m.geoCode.latitude"
[longitude]="m.geoCode.longitude"
(mouseOver)="onMouseOver(infoWindow,gm)"
>

<agm-info-window [disableAutoPan]="false" #infoWindow>

<div>
{{m.name}}
{{m.rating}}
</div>
<div>
<a (click)="onClickInfoView({id:m.id})" class="btn btn-attention pull-right">Daje <i class="fa fa-angle-double-right"></i></a>
</div>

</agm-info-window>


</agm-marker>

</agm-map>


onMouseOver(infoWindow, gm) {

if (gm.lastOpen != null) {
gm.lastOpen.close();
}

gm.lastOpen = infoWindow;

infoWindow.open();
}

关于angular - agm-marker onMouseOver 打开 agm-info-window,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46541611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com