Answer the question
In order to leave comments, you need to log in
Why doesn't navigator.geolocation from services work?
angular.module('events.services', [])
.factory('EventService', function($http, $cordovaSQLite) {
return {
getUserCoords: function() {
if (navigator.geolocation) {
return navigator.geolocation.getCurrentPosition(function(position) {
return position;
})
}
}
}
})
EventService.getUserCoords();
Answer the question
In order to leave comments, you need to log in
angular.module('events.services', [])
.factory('EventService', function($http, $cordovaSQLite) {
return {
getUserCoords: function() {
if (navigator.geolocation) {
var p;
navigator.geolocation.getCurrentPosition(function(position) {
p = position;
});
return p;
}
}
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question