Reputation: 3368
I'm using the angular google map api (http://goo.gl/dtD7hk). I would like to make the map pan to the a position.
In my controller I have the following function:
$scope.mapHome = function(){
$scope.map.center.latitude = $rootScope.center.lat;
$scope.map.center.longitude = $rootScope.center.lng;
};
But this doesn't work. How can I make google map pan? Would be really nice, if some way of animation was included. Zoom Out - pan - and zoom in to setting ($scope.map.zoom).
Thx!
Upvotes: 0
Views: 943
Reputation: 4239
Try re-assigning the center object in your scope instead of the latitude/longitude properties:
$scope.mapHome = function(){
$scope.map.center = {
latitude: $rootScope.center.lat,
longitude: $rootScope.center.lng
};
};
I implemented something similar and this worked for me.
Upvotes: 0