inputImage does not trigger when same file is uploaded twice
aptos opened this issue · 3 comments
When I upload, then make some change to the file and click the inputImage element again, the file_upload_element "change" binding won't trigger.
This also became apparent when I added a cancel button which clears the model, ala: $scope.image=null. After I cancel, then try to upload the same file again nothing would happen.
As a fix, I set the file_upload_element value to null after processing in the inputImage directive:
file_upload_element.bind("change", function (evt) {
<...snip...>
generic_image_processing_functions(files, attrs)
.then(update_model)
.then(function(){ file_upload_element[0].value=null; });
});
I'm not sure this is the best fix, but it works for me.
I'll accept a pr.
this directive is experimental.
I think it may be better to use plupload or some other library that has been worked on more.
thanks - I think I was into this directive because of your image preview. I'll check latest plupload for that.
that part is isolated and you can rip it out. hopefully it's easy. this directive most likely has many edge cases.