Accessing angularjs factory data outside promise
<p>I have a factory named <code>readingService</code> the factory method <code>GetLastSyncTimestamp</code> return a DateTime from a web service, after calling the factory I have assign return DateTime in <code>$scope.lastSyncTimestamp</code> variable, but problem  is inside the promise I can get the DateTime correctly</p>

<pre><code> readingService.GetLastSyncTimestamp($scope.id).then(function(d) {
            $scope.lastSyncTimestamp = d.data;
            console.log($scope.lastSyncTimestamp);
        });
</code></pre>

<p>but outside the promise I don't get any data</p>

<pre><code> readingService.GetLastSyncTimestamp($scope.id).then(function(d) {
            $scope.lastSyncTimestamp = d.data;
        });

console.log($scope.lastSyncTimestamp);
</code></pre>

<p>is there any way to get data outside the promise ?</p>