angular-google-maps
angular-google-maps copied to clipboard
changing center by position of marker?
hi Im trying to do the following action $scope.map.panTo($scope.marker.getPosition()); but $scope.map.panTo is not defined. what is the way to change center by position of marker?
uiGmapGoogleMapApi.then(function(maps) {
vm.map = {
center: {
latitude: $scope.config.lat || 32.0487335 ,
longitude: $scope.config.long || 34.7591261
},
zoom: 12 };
vm.options = { scrollwheel: false };
vm.marker = {
id: 0,
coords: {
latitude: $scope.config.lat,
longitude: $scope.config.long
}
}
$scope.$watch('vm.config', function(newConfig, oldConfig){
if (newConfig != oldConfig) {
//change center of map
$scope.map.panTo($scope.marker.getPosition());
}
}, true);
Ofcourse they are. Your using the same reference of data for both. The reference is mutable and if you change the values of it for the marker.. so center will change too.
it doesn't work. how can i make it work?
i can not get this work either. not panning to marker or zomming to marker!