agm-marker onMouseOver打开agm-info-window [英] agm-marker onMouseOver open agm-info-window
本文介绍了agm-marker onMouseOver打开agm-info-window的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 Angular Google Maps(AGM)组件。
我需要打开标记鼠标悬停的信息窗口。
如何在我的函数 onMouseOver
中检索 infowindow
实例来打开它?
I using Angular Google Maps(AGM) componet.
I need to open info window on marker mouse hover.
How can I retreive the infowindow
instance in my function onMouseOver
to open it?
<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?
}
推荐答案
解决方案:
At the end I found a solution:
<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();
}
这篇关于agm-marker onMouseOver打开agm-info-window的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文