Round Robin Upload Queue
I'm talking about the following scenario
- Use
- setting the queue limit to 1, because user only wants to upload one file
- User chooses 1 file, but then decides to change it, so he clicks "choose file" button again.
The UI of the element suggests file is changed, but the file uploader doesn't accept the file, since the queue reaches its limit. However, in this case, a round robin will be more desired.
I understand we can use ng-click="clearQueue()", however, this introduces an unnatural behavior. User could click the "choose file" accidentally. The default behavior for tag will allow user to click "cancel" and now to anything, but the click handler will clear the queue preemptively.
Round Robin queue would be cool.. I use this workaround with a filter.. (with nothing set for queueLimit). If you set it to 1, the filter doesn't get called.
$scope.logoUploader.filters.push({
name: 'overWriteLogoFilter',
fn: function(item /*{File|FileLikeObject}*/ , options) {
if(this.queue.length==1){
this.clearQueue();
}
return true;
}
});
+1 for what @michaelwsk's is asking. +1 for the workaround by @SridharSubramaniam, thank you!
That's what I was looking for, thx @SridharSubramaniam