我有一个柱塞,它显示一个谷歌地图,中心在40.74,-74.18。
http://plnkr.co/edit/BfYggKO8nDolhmpq92dq?p=preview
<!DOCTYPE html>
<html ng-app="ngMap">
<head>
<title>Simle Map</title>
<meta name="description" content="Simple Map">
<meta name="keywords" content="ng-map,AngularJS,center">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script src="https://maps.google.com/maps/api/js?libraries=placeses,visualization,drawing,geometry,places"></script>
<script src="https://code.angularjs.org/1.3.15/angular.js"></script>
<script src="https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.js"></script>
</head>
<body>
<ng-map center="[40.74, -74.18]"></ng-map>
</body>
</html>代码使用angularjs。使用的google-map angularjs库是http://ngmap.github.io/。
我想在附近添加图标,比如说,50.74,-74.18。这是如何做到的呢?

发布于 2015-12-11 10:40:35
可以为icon指令指定marker属性以设置自定义标记图标:
<script src="https://maps.google.com/maps/api/js?libraries=placeses,visualization,drawing,geometry,places"></script>
<script src="https://code.angularjs.org/1.3.15/angular.js"></script>
<script src="https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.js"></script>
<div ng-app="ngMap">
<ng-map center="[54.74, -74.18]" style="height: 480px;" zoom="4" >
<marker position="50.74, -74.18" title="Hello World!" icon="http://s19.postimg.org/scc4cevlv/marker_Icon.png"></marker>
</ng-map>
</div>
柱塞
https://stackoverflow.com/questions/34170074
复制相似问题