The promise does not return (end) on a deeper $q.reject. Maybe I am not doing this correctly. The cg-busy indicator keeps showing even when the getQuestions() promise has returned with a $q.reject. It works fine if it returns with a resolve NOT with reject. I understand that I can make this a single line $resource call but this is just representation of any other promise which may have more than one chained "then" promises. Any clue on what is going on is greatly appreciated.
` // Assign cg-busy assignment to this promise
$scope.questionsPromise = getQuestions();
// Get questions list from the backend
function getQuestions() {
var deferred = $q.defer();
var errorObj, errorMsg;
var restParams = {
"someId": $scope.someId,
"filter[IsActive][eq]": 1,
"sort[PriorityOrder]": "asc",
"limit": 500
}
ProjectQuestions.query(restParams).$promise
.then(function (results, getResponseHeaders) {
// Done retrieving if successful
$scope.questions = results.Items;
console.log(results.Items);
deferred.resolve();
}, function (err) {
errorMsg = "Failed retrieving list";
errorObj = { "status": 500, "message": errorMsg, "source": resourceTitle, "internal": err };
return $q.reject();
})
return deferred.promise;
}
The promise does not return (end) on a deeper $q.reject. Maybe I am not doing this correctly. The cg-busy indicator keeps showing even when the getQuestions() promise has returned with a $q.reject. It works fine if it returns with a resolve NOT with reject. I understand that I can make this a single line $resource call but this is just representation of any other promise which may have more than one chained "then" promises. Any clue on what is going on is greatly appreciated.
` // Assign cg-busy assignment to this promise $scope.questionsPromise = getQuestions();
`