adonespitogo / angular-base64-upload

Converts files from file input into base64 encoded models.
283 stars 121 forks source link

When reset form, not clear error #74

Closed DiV666 closed 7 years ago

DiV666 commented 8 years ago

Hi, congratulations and thanks for your library

When I reset the form, the error message still appears. Could you tell me why?

I made a codepen showing an error when the selected image has a size greater than 100kb http://codepen.io/DiV666/pen/oxKeOK

Thank you.

adonespitogo commented 8 years ago

This isn't implemented yet. You can assign null to your model for the mean time to reset the model and remove the errors.

DiV666 commented 8 years ago

Thanks for your response.

I tried to assign "null" to the vm.files variable like this "vm.files = null" but the error persist. Can you please give me more details about where I should use "null" in case Im doing it wrong?

I updated codepen http://codepen.io/DiV666/pen/oxKeOK

malde commented 8 years ago

@DiV666 did you manage to find a solution for this? I've got the same issue.

adonespitogo commented 8 years ago

I think this has something to do with your angularjs version. I haven't tested this module against versions greater than 1.3.15. I'll take a look at it when I have time.

DiV666 commented 8 years ago

No, I could not find a solution

bonya commented 8 years ago

I am facing the same issue. Current workaround is to modify _cleanInput method and add

scope._clearInput = function() {
    elem[0].value = '';
    ngModel.$setValidity('maxnum', true);
    ngModel.$setValidity('minnum', true);
    ngModel.$setValidity('maxsize', true);
    ngModel.$setValidity('minsize', true);
    ngModel.$setValidity('accept', true);
};
adonespitogo commented 7 years ago

I found the error, fixed in version v0.1.21. See this commit