1

I have this plunker which shows a google map with centre at [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>

The code uses angularjs. The google-map angularjs library used is http://ngmap.github.io/

I would like to add the icon below at a nearby point, say, [50.74, -74.18]. How can this be done?

enter image description here

guagay_wk
  • 26,337
  • 54
  • 186
  • 295

1 Answers1

2

You could specify icon attribute for marker directive to set custom marker icon:

<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>  

Plunker

Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193