I have an input type="file" in a web page. On onchange event i attached an event from an angular scope to validate the selected file.
This is my input element:
<input type="file" onchange="angular.element(this).scope().validateFile(this)"
accept="application/pdf, application/x-pdf, image/jpeg, image/pjpeg,
image/gif, image/png, image/bmp, image/x-windows-bmp, image/tiff, image/x-tiff"/>
This is my validate method and it doesn't work to remove the element with e.preventDefault()
or with return false
:
$scope.validateFile = function (e) {
var result = dmsTaskSevice.validateFile(e)
if (result.isValid === false){
alert(result.message);
e.preventDefault();
return false;
}
};
There is any way to remove the file just selected?