Closed sbyim closed 9 years ago
angular.module('won.owner').factory('mapService', function () { var currentGeolocation = new google.maps.LatLng(35.784, -78.670);
return {
getInitialLocation:function(){
//var initialLocation;
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position) {
currentGeolocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
var temp =new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
return currentGeolocation;
},function(){
this.handleNoGeolocation();
},{timeout:10000})
}
else {
alert('gelocation not supported');
}
},
handleNoGeolocation:function(){
return currentGeolocation;
},
getGeolocation:function(){
this.getInitialLocation();
return currentGeolocation;
}
}
});
location service only works when page is reloaded..
maybe this could help.. https://angular-ui.github.io/angular-google-maps/#!/use
not relevant anymore.
Google maps locating feature doesn't work when creating needs