terikon / marker-animate-unobtrusive

Google Maps markers become animated, unobtrusively

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular ng-repeat problem

sirfilipef opened this issue · comments

I have a problem, when i add just one point without ng-repeat the easing works fine,

<marker easing="linear" duration="2000" id="{{$index}}" position="[{{positions[2].lat}}, {{ositions[2].lng}}]" title="pos: {{positions[2]}}"> </marker>

but when i add the ng-repeat, the easing doesnt work.

<marker easing="linear" duration="2000" ng-repeat="p in positions" id="{{$index}}" position="[{{p.lat}}, {{p.lng}}]" title="pos: {{p}}"> </marker>

Any idea?

Strange. Can you please create a small demo of your issue in plnker/codepen/jsfiddle?

Ok, if you do

  ng-repeat="pos in vm.positions"

angular will create new marker each time positions are being updated.
You want to treat position so first one belongs to the first marker, second to the second etc. By index.
Try this:

   ng-repeat="pos in vm.positions track by $index"

It will do the job.

You welcome