I'm having an issue resolving my promise—the strange this is that in my markup:
{{details.customer_email}}
It resolves properly, and displays the e-mail address returned by the '$http` request.
However, attempting to access this:
$scope.user = {
...
emailAddress : $scope.details.customer_email,
...
};
is null.
Here's the relevant block:
$scope.session = {
is_authenticated: false,
customer_email: null
};
var detailsDeferred = $q.defer();
$scope.details = detailsDeferred.promise;
$scope.authed = function () {
$http({
url: 'http://api.foo/auth',
withCredentials: true,
method: "GET",
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).success(function (data, status, xhr) {
$scope.session = {
is_authenticated: data.is_authenticated,
customer_email: data.customer_email
};
detailsDeferred.resolve($scope.session);
})
...
return $scope.session;
};
$scope.authed();
$scope.user = {
...
emailAddress: $scope.session.customer_email
...
};