Closed jdkenney closed 7 years ago
I see this issue too. Probably this issue is generated by the fact that since version 3.22 the pan control of the map is no longer available. At the moment, the solution is to explicitly call version 3.21, that is the current "release" version. This version will change to "frozen" in November 2015 but it will removed on February 2016.
I found the solution, the problem is with the object LatLng. With version 3.22 it was changed its structure and $scope.center = new google.maps.LatLng (lat, lng) is no longer executed. It must be replaced with $scope.gmap.panTo(new google.maps.LatLng(lat, lng)) This is my simple_map.js for the demo at: http://dylanfprice.github.io/angular-gm/1.0.2/examples/#!/map/
angular.module('simple-map', ['AngularGM']) .run(function (angulargmContainer, $rootScope) { var gmapPromise = angulargmContainer.getMapPromise('simpleMap'); gmapPromise.then(function (gmap) { // google map configuration here $rootScope.gmap = gmap; }); }) .controller('SimpleMapCtrl', function($scope) { $scope.$watch('center', function(center) { if (center) { $scope.centerLat = center.lat(); $scope.centerLng = center.lng(); } });
$scope.updateCenter = function(lat, lng) { // $scope.center = new google.maps.LatLng(lat, lng); $scope.gmap.panTo(new google.maps.LatLng(lat, lng)); }; });
Great thanks @frankcrisa I will try to get a fix out this weekend.
On Wed, Nov 4, 2015 at 5:15 AM, frankcrisa notifications@github.com wrote:
I found the solution, the problem is with the object LatLng. With version 3.22 it was changed its structure and $scope.center = new google.maps.LatLng (lat, lng) is no longer executed. It must be replaced with $scope.gmap.panTo(new google.maps.LatLng(lat, lng)) This is my simple_map.js for the demo at: http://dylanfprice.github.io/angular-gm/1.0.2/examples/#!/map/
angular.module('simple-map', ['AngularGM']) .run(function (angulargmContainer, $rootScope) { var gmapPromise = angulargmContainer.getMapPromise('simpleMap'); gmapPromise.then(function (gmap) { // google map configuration here $rootScope.gmap = gmap; }); }) .controller('SimpleMapCtrl', function($scope) { $scope.$watch('center', function(center) { if (center) { $scope.centerLat = center.lat(); $scope.centerLng = center.lng(); } });
$scope.updateCenter = function(lat, lng) { // $scope.center = new google.maps.LatLng(lat, lng); $scope.gmap.panTo(new google.maps.LatLng(lat, lng)); }; });
— Reply to this email directly or view it on GitHub https://github.com/dylanfprice/angular-gm/issues/83#issuecomment-153716649 .
@frankcrisa works for me, thanks!
I pushed a fix for this, which involved changing the contract of gm-center to deal in google.maps.LatLngLiteral objects instead of google.maps.LatLng objects. I'll go through the process of putting out a new version when I get another chance.
As in title:
AngularGM directive no longer works with the 3.22 (exp) update as of Oct. 11, 2015. The AngularGM demo page is also currently broken: http://dylanfprice.github.io/angular-gm/1.0.2/examples/#!/map/
Unfortunately the release notes (https://developers.google.com/maps/documentation/javascript/releases#322) for exp are only current to Sept. 22, 2015 so I'm not sure what changed in this update.
The problem is at least with changing the value of center in the gm-center attribute, although it seems like the initial location specified in gm-map-options is also ignored.