Reputation: 4611
Here is the code:
var dbDelivery = Deliveries.get({deliveryId: delivery.id}, function() {
if (!dbDelivery.id) {
toaster.pop('error', 'Error', 'That delivery does not exist. Somebody else may have deleted it.');
var deliveryIndex = $rootScope._.findIndex($scope.deliveries, 'id', delivery.id);
$scope.deliveries.splice(deliveryIndex, 1);
return;
}
dbDelivery.confirmed = true;
dbDelivery.$update(function() { delivery.confirmed = true; }, ServerErrorAlert);
return dbDelivery.$promise;
})
Questions: 1) What happens if one calls multiple resource methods on a resource and returns the $promise? Does it just depend on the last method executed? 2) What is $resource looking for in order to reject the promise? I mean does it just depend on the response status code? If so which status codes result in a success and which result in error?
Upvotes: 0
Views: 46