为什么当我在一个位置添加多个引脚时,只显示一个引脚?
我的代码(我正在使用Ionic Framework / AngularJs)
var myLatlng = new google.maps.LatLng(8.4844173, 124.6526134);
var mapOptions = {
center: myLatlng,
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var infowindow = new google.maps.InfoWindow({
maxWidth: 185
});
var setMarkers = new Array();
for( var i in data ) {
var position = new google.maps.LatLng(data[i].lat, data[i].lon);
setMarker = new google.maps.Marker({
position: position,
map: map,
content: data[i].description
});
google.maps.event.addListener(setMarker, 'click', (function (setMarker, i) {
return function () {
infowindow.setContent("<div class='card'><div class='item item-body'><a href='#/home/posts/"+data[i].id+"'><img style='width:100%;height100%;' src='http://crowdalert.me/images/"+data[i].image+"'></a></div><div class='item item-divider'><p><i class='ion-clock'></i> "+data[i].created_at+"</p></div></div>");
infowindow.open(map, setMarker);
}
})(setMarker, i));
setMarkers.push(setMarker);
}