Skip to content

Instantly share code, notes, and snippets.

@cloudmanic
Last active January 1, 2016 04:29
Show Gist options
  • Save cloudmanic/92adaaffed4216985233 to your computer and use it in GitHub Desktop.
Save cloudmanic/92adaaffed4216985233 to your computer and use it in GitHub Desktop.
uploader.bind('afteraddingall', function (event, items) {
// Loop through all the files and add their preview image to
// the item object. This way we cain call "src" in the dom.
// <img src="{{item.src}}" /> for example.
angular.forEach($scope.uploader.queue, function(value, key)
{
var type = value.file.type;
if(uploader.hasHTML5 && ((type == 'image/jpeg') || (type == 'image/png')))
{
var reader = new FileReader();
reader.onload = function (e) {
$scope.uploader.queue[key].src = e.target.result;
$scope.$apply();
}
reader.readAsDataURL(value.file);
}
});
}););
<tr ng-repeat="item in uploader.queue">
<td>
<img id="blah" src="{{item.src}}" width="50" alt="your image" />
<strong>{{ item.file.name }}</strong>
</tr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment