找不到关于<ui-gmap-markers>
的任何文档,只是试图获得非常基本的
content = "<div><h3>Title</h3>Text here..</div>"
。所有文档都用于单数标记。
$scope.change_type = function(val) {
content = "<div><h3>Title</h3>Text here..</div>"
$scope.markers = [] //clears the map
$scope.markers = Events.venues(val.type)
}
标记数据就像
{options:{ title:"Barney's"},type:'Bar', latitude: 42.992538, longitude: -81.251819}
我在index.html
<script src='lib/lodash/dist/lodash.js'></script>
<script src='lib/angular-google-maps/dist/angular-google-maps.js'></script>
<script src='lib/addons/markerwithlabel.js'></script>
答案 0 :(得分:1)
我希望这可以帮到你 - 我今天想出了如何利用ui-gmap-markers
,所以原谅任何粗糙的边缘。
我的HTML,运行正常:
<ui-gmap-google-map center='main.map.center' zoom='main.map.zoom' options='main.map.options'>
<ui-gmap-markers models="main.markers" coords="'self'" icon="'icon'" options="'options'" click="'onClick'" fit="true">
<ui-gmap-windows show="'showWindow'" closeClick="'closeClick'" ng-cloak>
<div data-ui-sref="display">
<span data-ng-non-bindable>{{ title }}</span>
</div>
</ui-gmap-windows>
</ui-gmap-markers>
</ui-gmap-google-map>
在我的控制器中,我这样做:
uiGmapGoogleMapApi.then(function(maps) {
var markers = [];
_.each(vm.itemlist,function(item){
search.getGeometry(item.href).then(function(marker) { // I look up gps coord elsewhere
marker.id = item.href;
marker.showWindow = false;
marker.options = {
title: item.name,
icon: markericon.normal
};
marker.onClick = function() { vm.markerClick(marker); };
marker.closeClick = function() { vm.markerCloseClick(marker); };
markers.push(marker);
});
});
vm.markers = markers;
});
希望你从中获得一些提示......