A little modification to dropzone.js requires everything to look beautiful, but otherwise it's just a directive.
My dropzone now repeats (endlessly, but I will fix it later) until it succeeds. It takes a bit more work to reset the progress bars, but that should be enough to get you somewhere (if you still need to do this).
Editing in dropzone.js (in the improved version):
success: function(file) {
file.previewElement.classList.remove("dz-error");
return file.previewElement.classList.add("dz-success");
}
Where I added the delete line. This changes the Xs to ticks when the file loads successfully.
The angular directive follows:
.directive('dropZone', function($rootScope) {
return function ($scope, element, attr) {
var myDropZone = element.dropzone({
url: "api/ImageUpload",
maxFilesize: 100,
paramName: "uploadfile",
maxThumbnailFilesize: 5,
autoProcessQueue: false,
parallelUploads: 99999,
uploadMultiple: false,
params: {identifier: $scope.identifier},
init: function(){this.on("addedfile", function(file){$rootScope.$digest();})}
});
$scope.dropZone = myDropZone.context.dropzone;
$scope.errors = [];
myDropZone.context.dropzone.addEventListener("error", function(file,errorMessage,xhr)
{
$scope.errors.push(file.name);
myDropZone.context.dropzone.uploadFile(file);
});
myDropZone.context.dropzone.addEventListener("success", function(file,errorMessage,xhr)
{
$scope.errors.splice($scope.errors.indexOf(file.name), 1);
});
myDropZone.context.dropzone.addEventListener("queuecomplete", function()
{
if($scope.errors.length == 0)
{
$scope.uploadComplete();
}
});
};
})
, , myDropZone.context.dropZone, javascript console.logging() . dropzone, , ?