【发布时间】:2019-06-20 13:47:04
【问题描述】:
<div #gmap class="map"></div>
for (let marker of this.markersDisplay) {
let markerColor = (marker.MarkerType == MarkerType.Ok) ? "green" : (marker.MarkerType == MarkerType.Warning) ? "yellow" : "red";
let markerClick = new google.maps.Marker(
{
position: new google.maps.LatLng(marker.Latitude, marker.Longitude),
map: this.map,
title: marker.Title,
visible: marker.Visible,
clickable: marker.Clickable,
icon: 'http://maps.google.com/mapfiles/ms/icons/' + markerColor + '-dot.png',
});
markerClick.addListener('click', () => { this.MarkerClick(marker); });
}
}
我需要过滤地图上的标记。在添加新的之前,我想清除地图上的所有标记。该怎么做?
【问题讨论】:
标签: javascript angular google-maps-api-3 google-maps-markers