Using Tastypie and AngularJS $resource I would like to perform a set of update, create and delete operations.
Currently, I broadcast an event:
$rootScope.$broadcast('save');
That event is captured by each controller responsible for creating, updating and deleting using the $resource
service:
ResourceService.update({id:$scope.id}, $scope.element).$promise.then(function(element) {
$scope.$emit('saved');
});
Now, this cause some race conditions both at client side and on server side.
What would be the simplest way to perform this set of operations as a batch in the REST way?
I recently played around with Angular HTTP Batcher
however if you want a more generic JS only async helper you can use Async
I think those are mostly what you are looking for, the blog post from the Angular HTTP Batcher is a good read.