我最近将 angular-google-maps 升级到 2.0.12,当我单击标记时,我的自定义模板(用于窗口)没有加载。它以前工作得很好。我已经参考了所有文档和变更日志,但无济于事(这就是我首先使标记起作用的方式)。有人可以帮我解决这个问题。
这是我的哈姆观点:
%ui-gmap-google-map(center='map.center' pan='map.pan' options='map.options' draggable='true' zoom='map.zoom')
%ui-gmap-markers(models='map.markers' icon="'icon'" coords="'self'" click="'click'" events="'events'")
%ui-gmap-windows(show="'showWindow'" closeClick="'closeClick'" isIconVisibleOnClick="'isIconVisibleOnClick'" options='map.infoWindowCustomClass.options' templateUrl="'templateUrl'" templateParameter="'templateParameter'")
这是我推送标记模型的咖啡脚本代码:
$scope.map.markers.push
id:index
icon:'images/ignore/marker.png'
latitude: latlongs[index].latitude
longitude: latlongs[index].longitude
showWindow:false,
templateUrl:'views/maptooltip.html'
appName:latlongs[index].app
userName:latlongs[index].usr
city:latlongs[index].city
country:latlongs[index].country
click:()->
$scope.map = mapSettings.setMapCenter({
latitude:this.model.latitude-30
longitude:0
})
this.model.showWindow = true
this.model.templateParameter={}
this.model.templateParameter.appName = this.model.appName;
this.model.templateParameter.userName = this.model.userName;
this.model.templateParameter.city = this.model.city;
this.model.templateParameter.country = this.model.country;
$scope.$apply()
closeClick:()->
this.model.showWindow = false
$scope.$apply()
这是我的地图对象:
zoom: 2
pan:true
center:
latitude: 40
longitude: 0
infoWindowCustomClass:
options:
boxClass:'dashboard-new-tooltip'
options:
minZoom:2
maxZoom:11
disableDefaultUI:true
styles:[{
"featureType": "water",
"stylers": [
{ "color": "#1B2028" }
]
},{
"featureType": "poi",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "road",
"stylers": [
{ "visibility": "off" }
]
}
,{
"elementType": "labels",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "transit",
"elementType": "all",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "administrative",
"stylers": [
{ "visibility": "off" }
]
},{
"featureType": "landscape",
"stylers": [
{ "color": "#4e555f" }
]
}]