Hi i have installed ngCordova and trying to accesss the lat long value using this function
$scope.lat = '';
$scope.long = '';
var posOptions = {timeout: 10000, enableHighAccuracy: false};
$cordovaGeolocation.getCurrentPosition(posOptions)
.then(function (position) {
$scope.lat = position.coords.latitude
$scope.long = position.coords.longitude
}, function (err) {
// error
});
console.log($scope.lat, $scope.long);
When i console it exactly below the assignment of values to lat and long variables then it provide me the result on console but when i console it outside as i have displayed in the question, it shows me empty string. What is it happening?