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?
$resource
does not support sending all the data in a single xhr. Do I have to implement the 'batch' xhr using$http
or is there an api such as Restangular that will do it for me? – Distribution