我在地图上添加标记时遇到了困难。我没有收到任何错误,但仍然没有显示。
控制器
.....
var load = [];
for (var i=0; i < $scope.events.length; i++) {
var marker = {
id: i,
coords:{
latitude: $scope.events[i].location.geometry[1],
longitude: $scope.events[i].location.geometry[0]
},
icon: "images/icons/markertag.png"
};
load.push(marker);
}
$scope.randomMarkers = load;
......
查看
<ui-gmap-google-map center='map.center' zoom='map.zoom' options='map.options'>
<ui-gmap-markers models="randomMarkers" coords="'self'" icon="'icon'" idKey="'id'"></ui-gmap-markers>
</ui-gmap-google-map>
数组randomMarkers是正确的,因为我检查数组是否包含信息。
地图正在加载,但没有显示任何标记。
有什么想法吗?
答案 0 :(得分:1)
正如itachi评论的那样:
<ui-gmap-google-map center='map.center' zoom='map.zoom' options='map.options'>
<ui-gmap-markers models="randomMarkers" coords="'coords'" icon="'icon'" idKey="'id'"></ui-gmap-markers>
</ui-gmap-google-map>
将自己变为coords。
工作!
谢谢