0

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!

4

1 回答 1

0

尝试重新分配范围内的中心对象而不是纬度/经度属性:

$scope.mapHome = function(){    
    $scope.map.center = {
        latitude: $rootScope.center.lat,
        longitude: $rootScope.center.lng
    };
};

我实现了类似的东西,这对我有用。

于 2014-10-21T18:06:16.477 回答