I have a factory named readingService
the factory method GetLastSyncTimestamp
return a DateTime from a web service, after calling the factory I have assign return DateTime in $scope.lastSyncTimestamp
variable, but problem is inside the promise I can get the DateTime correctly
readingService.GetLastSyncTimestamp($scope.id).then(function(d) {
$scope.lastSyncTimestamp = d.data;
console.log($scope.lastSyncTimestamp);
});
but outside the promise I don't get any data
readingService.GetLastSyncTimestamp($scope.id).then(function(d) {
$scope.lastSyncTimestamp = d.data;
});
console.log($scope.lastSyncTimestamp);
is there any way to get data outside the promise ?