Closed gauravsaini03-zz closed 10 years ago
I have just used this solution : You can use a .run function in your app.js. You can get your map this way in your run function :
var gmapPromise = angulargmContainer.getMapPromise('yourMapId');
gmapPromise.then(function(gmap) {
gmap.setCenter(new google.maps.LatLng(position.coords.latitude, position.coords.longitude));
}
);
navigator.geolocation.watchPosition(function(position) {
gmap.setCenter(new google.maps.LatLng(position.coords.latitude, position.coords.longitude));
});
});
})
Where "yourMapId" is your CSS Id for your gmap.
Thanks AmbikaFR, I actually was able to resolved the problem. onSuccess of geolocation I passed new lat and long and applied it.
var onSuccess = function(position) {
$scope.map.center = {
latitude: position.coords.latitude,
longitude: position.coords.longitude
};
$scope.$apply();
}
Hello,
I am unable to re-create map, after getting the gelocation of user, with new Lat and Long. I searched but did not see any way to work with geolocation.
Thanks Gaurav