Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple mapbox instances and markers #24

Open
bastronaut opened this issue Jun 4, 2015 · 1 comment
Open

Multiple mapbox instances and markers #24

bastronaut opened this issue Jun 4, 2015 · 1 comment

Comments

@bastronaut
Copy link

Hi,

I'm working with multiple mapbox instances on the same page, and it does not properly handle adding markers with ng-repeat. Looking at the angular-mapbox.js, it seems that this is still a work in progress;

      // TODO: tie markers to specific map instance

I would like to be able to solve this, but I'm new to angular and can't quite figure it out. The addMarker function on line 444 receives a map instance it will add the markers to. This map is passed after getting it through the controller.getMap() call. However, I dont understand the implementation of getMap() or where to modify it. Could you point me in the right direction?

PS: for anyone looking for a nasty hacky workaround; I've added a mapinstance=x to the marker element, and in the marker directive I've placed a condition to check this value in attrs.mapinstance , and depending on the passed value I'm setting map = mapboxService.getMapInstances()[x] (line 420). Although this works, it may not be the right solution, as I'm simply overwriting the passed map argument. (I have no idea of the side effects, though I haven't experienced any bugs so far)

Thanks for the great work!

@elarion
Copy link

elarion commented Sep 2, 2015

Hi, I have the same issue and my markers aren't updating well.
So what I do is that I generate a static map and a dynamic map instead of two dynamics...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants