Reputation: 998
Cant find an solutions how to do this with uiGmapGoogleMapApi
.Since google
object is not imported, cant use regular solutions.
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.
Upvotes: 1
Views: 430
Reputation: 997
// 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 = [];
Upvotes: 2