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

前端之家收集整理的这篇文章主要介绍了angular – agm-marker onMouseOver打开agm-info-window前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用 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?
    }
@H_502_8@ 最后我找到了一个解决方案:
<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();
    }
原文链接:https://www.f2er.com/angularjs/240471.html

猜你在找的Angularjs相关文章