What you want to do is call the resolution function in the promise when the function has all the necessary data for the actual return
in a function that returns a promise, think of “resolution” as the actual return statement.
isLoggedInPromise , . , , .
isLoggedInPromise().then(function(result){...etc...}, function(reason){//auth needed})
isLoggedin,
function isLoggedInPromise() {
var isLoggedIn = userWithAllData().then(
function(user) {
return user;
},
function(reason){
return $q.reject("AUTH_REQUIRED")
});
}
, userWithAllData.