I am trying to return the output of a promise. However, I am just getting the actual promise, instead of the value.
What am I doing wrong?
Here's my code:
$rootScope.distance = function(lon1, lat1) {
var deferred = $q.defer();
$cordovaGeolocation.getCurrentPosition()
.then(function (position) {
deferred.resolve(position);
}, function(err) {
});
return deferred.promise;
}
...and the result