Reputation: 89
Currently trying to learn AngularJS, I am playing around with image upload functions and using ng-thumb to preview the image file being uploaded. What I am trying to do right now is set the ng-thumb to show a default image and have that image be overriden when a new image is uploaded.
<div class="row-fluid col-md-12 text-center" ng-repeat="item in uploader.queue">
<div ng-thumb="{ file: item._file, height: 200, width: 300}"></div>
</div>
Is there a way to set a default image for ng-thumb? Thanks for your help.
Upvotes: 2
Views: 1609
Reputation: 263
You can create a new Image() with JavaScript API explained here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image
and use this image with ng-thumb. ( ng-thumb = "{ file: newImage, height: 200, width: 300}" )
Upvotes: 1