title: NgMap: Why are my markers (ng-repeat directive) passing through multiple parameters?
body: <p>I'm using the NgMap library to use the google maps api in my angular app.</p>
  
  <p>I'm adding markers using an ng-repeat directive, each with an on-click tag that calls to the controller and logs to the console.</p>
  
  <pre><code>&lt;ng-map zoom="11" center="[40.74, -74.18]"&gt;
    &lt;marker ng-repeat="p in vm.positions"
      position="{{p.pos}}"
      on-click="vm.showData(p)" //this is my on-click event, passing through the ng-repeated object
      title="pos: {{p.pos}}"&gt;&lt;/marker&gt;
  &lt;/ng-map&gt;
  </code></pre>
  
  <p>For some reason, every time I pass a parameter to my controller function it's actually the marker object being passed through, not the argument I'm passing from the view.</p>
  
  <pre><code> vm.showData = function (marker, param){
        console.log(marker) //WHY IS MARKER BEING PASSED THROUGH?!
        console.log(param.name); //THE SECOND ARGUMENT IS THE ONE I WANT, WHY ISN'T IT THE FIRST?
   }
  </code></pre>
  
  <p>Eventually after banging my head against the wall, I decided to check if any other arguments were being passed through to the controller function. Low and behold the second argument was the one I expected to be passed through to begin with.</p>
  
  <p><strong>Why isn't the first argument the one I'm expecting?!</strong> Is it something to do with the ngMap library, angular, or just a javascript nuance I'm unaware of?</p>
  
  <p>A working plunker can be found here: <a href="https://embed.plnkr.co/TQpm4O/" rel="nofollow noreferrer">https://embed.plnkr.co/TQpm4O/</a></p>