[英]AngularJS - Google Map Markers Removal
Cant find an solutions how to do this with uiGmapGoogleMapApi
.Since google
object is not imported, cant use regular solutions. 无法找到解决方案如何使用
uiGmapGoogleMapApi
进行此uiGmapGoogleMapApi
。由于未导入google
对象,因此无法使用常规解决方案。
My markers update via: 我的标记通过以下方式更新:
$scope.change_type = function(val) {
var markers = [];
$scope.eventMarkers = markers
var events = Events.venues(val.type)
for (var i = 0; i < events.length; i++) {
event = events[i]
markers.push(createMarker(i,event))
}
$timeout(function(){$scope.eventMarkers = markers}, 100)
My temp work around was to create timeout long enough for it to update before pushing new, but this is not a real solution and doesnt work too well on an actual device. 我的临时解决方法是创建足够长的超时,以便在推送新超时之前对其进行更新,但这不是一个真正的解决方案,并且在实际设备上不能很好地工作。 Pushing empty array of markers also didnt work.
推空标记数组也没有用。 Seems like I have to use
.setMap(null)
but cant find any documentation on how and where. 似乎我必须使用
.setMap(null)
但找不到有关如何以及在何处的任何文档。
// Removes the markers from the map, but keeps them in the array. function clearMarkers() { setAllMap(null); // Deletes all markers in the array by removing references to them. function deleteMarkers() { clearMarkers(); markers = [];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.