title: Using ng-repeat with markers in ngMap
body: <p>I want to use <a href="https://github.com/allenhwkim/angularjs-google-maps" rel="noreferrer">ngMap</a> to add Google Maps to my app. </p>
  
  <p>The demos are "static" in the sense that they have only hard coded HTML. I want my code to be "dynamic" in the sense that it will periodically ask a server to look in its database and return me a bunch of coordinates to plot, which will change with time. I hope that that is clear; if not, please ask for more detail.</p>
  
  <p>I modified the <a href="https://rawgithub.com/allenhwkim/angularjs-google-maps/master/examples/marker.html" rel="noreferrer">ngmap markers demo</a> to generate some random lat/long coordinates every two seconds (rather than going to my server, as my final app will). Please see <a href="http://plnkr.co/edit/xcRYfXZa6sSteU61RCBA?p=preview" rel="noreferrer">the Plunk</a>.</p>
  
  <p>There are no errors in the console, and it seems that ngMap is trying to add my markers, as I see a lot of this sort of thing in the console ...</p>
  
  <pre><code>adding marker with options,  
  Object {ngRepeat: "myMarker in markers", position: O}
  clickable: true
  ngRepeat: "myMarker in markers"
  position: O
  A: 103.96749299999999
  k: 1.387454
  __proto__: O
  visible: true
  __proto__: Object
  </code></pre>
  
  <p>where K and A are the Lat/Long as I expect them to be.</p>
  
  <p>BUT ... I don't see any markers on the map. What am I doing wrong?  </p>
  
  <hr>
  
  <p>[Update] An excellent answer, for which I gladly awarded a bounty afterwards. For anyone else reading this and wishing to use ngMap as @allenhwkim said in another stackoverflow question and, I think, on his blog, ngMap just creates the map for you &amp; after that you manipulate it with the standard Google Maps API. </p>
  
  <p>For instance, just before looping to add the markers, I declared<br>
  <code>var bounds = new google.maps.LatLngBounds();</code> and in the loop, after adding the marker to the map, I <code>bounds.extend(latlng);</code> and, finally, after the loop, I  </p>
  
  <pre><code>var centre = bounds.getCenter();  
  $scope.map.setCenter(centre);
  </code></pre>
  
  <p>I forked the answer and created <a href="http://plnkr.co/edit/1ZATMU5hsSNLNUp37wPj?p=preview" rel="noreferrer">a new Plunk</a> to show this. Not the world's most useful functionality, but the point is just to show how to use <code>$scope.map</code> with the Google Maps API. Thanks again, Allen, for ngMap.</p>