dylanfprice / angular-gm

AngularJS Google Maps Directives
MIT License
197 stars 47 forks source link

How I cant change map center in another controller? #14

Closed mikeandersun closed 11 years ago

mikeandersun commented 11 years ago

I need focus on a bookmark on map from another controller. Is there any way to do this? Thanks in advance.

wpalahnuk commented 11 years ago

Whenever you're looking to share something between controllers you usually want to use a service. Create a service that holds a map center var, change it in one controller and watch it in the other.

If you create a jsfiddle or plunkr of what you have now, I'll go through it and point out what you need to do.

mikeandersun commented 11 years ago

I create a service and work fine. I have a list that contains objects with location, now when click on one of them the map center set to selected object's location. Thanks a lot for your advise.