如何在 <agm-map> angular 中使用鼠标悬停 4

How to use mouseover in <agm-map> angular 4

我在 angular 4 应用程序中将 AgmMap 用于地图。如何在显示 info-window 的 agm-marker 中实现鼠标悬停事件。我需要在标记鼠标悬停时打开信息 window。如何在我的 onMouseOver 函数中检索 infowindow 实例以将其打开? 这是我的 map.component.html 文件

<agm-map [latitude]="lat" [longitude]="lng">
  <agm-marker *ngFor="let m of markers; let i = index"
          [latitude]="m.lat"
          [longitude]="m.lng"
          (markerClick)="clickedMarker(m, i)"
          [iconUrl]="m.iconUrl">
          <agm-info-window>{{m.label}}</agm-info-window>
  </agm-marker>
</agm-map>

和map.component.ts文件

import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { AlertService, AuthenticationService } from '../_services/index';
import { Ng4DropdownModule } from 'ng4-material-dropdown';
import { Http } from '@angular/http';
import 'rxjs/add/operator/map';

@Component({
   moduleId: module.id,
  templateUrl: './map.component.html',
  styleUrls: ['./map.component.css']
})

export class MapComponent implements OnInit {
   title: string = 'My first AGM project';  
  lat: number = 51.673858;
  lng: number = 7.815982;

  ngOnInit() {
  }

  markers: marker[] = [
      {
          lat: 51.673858,
          lng: 7.815982,
          label: 'Map A',
          draggable: true,
          iconUrl:'http://maps.google.com/mapfiles/ms/icons/green.png'
      },
      {
          lat: 51.373858,
          lng: 7.215982,
          label: 'Map B',
          draggable: false,
          iconUrl:'http://maps.google.com/mapfiles/ms/icons/red.png'
      },
      {
          lat: 51.723858,
          lng: 7.895982,
          label: 'Map C',
          draggable: true,
          iconUrl:'http://maps.google.com/mapfiles/ms/icons/yellow.png'
      }
  ];

  constructor() {
   }

   clickedMarker(marker:marker, index:number)
   {
    console.log('Clicked Marker:'+ marker.label+' at index'+index);
   }


}
interface marker {
    lat: number;
    lng: number;
    label?: string;
    draggable: boolean;
    iconUrl?: string;
}

你能帮帮我吗?如何在AgmMap中实现mouseover事件?

您可以使用(mouseOver)="mouseOver($event)"

<agm-marker *ngFor="let m of markers; let i = index" (markerClick)="clickedMarker(m,i)" [latitude]="m.lati" [longitude]="m.longi"
 (mouseOver)="mouseOver($event)">
</agm-marker>