问题
hi i am using angularjs image upload functionality once i upload the image . uploaded image will show img src tag after showing i need refresh the input type file but now image shows but that path still there i need refresh or delete the path after iamge show in thumbnail
code
<input id="fileMobile" type="file" ngf-select ng-model="up.file" name="file" onchange="angular.element(this).scope().file_changed(this)"
ngf-pattern="'image/*'" accept="image/*" ngf-max-size="4MB" />
<img ng-src="rfile" style="width:80px;" ng-show="!!up.file" ngf-thumbnail="up.file " />
http://jsfiddle.net/824Ldzd8/4/
after image show i want remove the filename in file upload
回答1:
[OdeToCode posted great service] http://odetocode.com/blogs/scott/archive/2013/07/03/building-a-filereader-service-for-angularjs-the-service.aspx for this stuff. So with this simple directive you can easily preview and even see the progress bar:
.directive("ngFileSelect",function(){
return {
link: function($scope,el){
el.bind("change", function(e){
$scope.file = (e.srcElement || e.target).files[0];
$scope.getFile();
});
}
}
Here is the Example: http://plnkr.co/edit/y5n16v?p=preview
I Hope this help you.
来源:https://stackoverflow.com/questions/43368942/how-to-refresh-input-type-file-in-angularjs