rod*_*ing 8 javascript google-maps angularjs
我正在使用Angular UI地图,似乎无法找到更改样式选项的指令.Googles文档提供了一个使用google对象的示例.我为地图尝试了getElementById,但这会导致ui对象出现大量错误.
我的控制器有:
$scope.map = { center: { latitude: 42.99, longitude: -81.255 }, zoom: 14, bounds: {}};
Run Code Online (Sandbox Code Playgroud)
虽然HTML是:
<div id="map_canvas">
<ui-gmap-google-map id='customMap' center="map.center" zoom="map.zoom" draggable="true" options="options" bounds="map.bounds">
<ui-gmap-markers models="eventMarkers" coords="'self'" idKey="'id'" icon="'icon'" click="'onClick'">
<ui-gmap-windows show="show">
<div ng-non-bindable>{{content}}</div>
</ui-gmap-windows>
</ui-gmap-markers>
</ui-gmap-google-map>
</div>
Run Code Online (Sandbox Code Playgroud)
简单地尝试向style范围添加适当的代码,没有改变任何东西,或导致任何错误.
Bri*_*top 15
添加样式非常简单,只需将它们添加到控制器中,如下所示:
var styleArray = [ //any style array defined in the google documentation you linked
{
featureType: "all",
stylers: [
{ saturation: -80 }
]
},{
featureType: "road.arterial",
elementType: "geometry",
stylers: [
{ hue: "#00ffee" },
{ saturation: 50 }
]
},{
featureType: "poi.business",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
$scope.options = {
styles: styleArray
};
Run Code Online (Sandbox Code Playgroud)
其他所有内容都可以与上面的代码保持一致.
| 归档时间: |
|
| 查看次数: |
5561 次 |
| 最近记录: |