I'm using ng-dropzone for manage my images files uploads. It works well in single ng-dropzone in a single page, but when comes to multiple dropzones in a single page, only the last dropzone will works. The other dropzone won't work. Currently, I'm getting image URL from the backend and parse into dropzone as the default thumbnail image.
HTML
// Doesn't show the thumbnail image
<ng-dropzone ng-show="random", options="dzOptionInit" callbacks="dzCallbacks" methods="dzMethods" class="dropzone"></ng-dropzone>
// Show thumbnail image
<ng-dropzone ng-show="random2", options="dzOptionInit" callbacks="dzCallbacks" methods="dzMethods" class="dropzone"></ng-dropzone>
Controller
$scope.dzMethods = {};
$scope.dzOptionInit = {
url: '#',
paramName : 'photo',
maxFilesize : '25',
acceptedFiles : 'image/jpeg, images/jpg, image/png',
addRemoveLinks : true,
autoProcessQueue : false,
maxFiles: 1
};
$scope.dzCallbacks = {
'addedfile' : function(file){
$scope.newFile = file;
..
},
'success': function(){
..
},
'removedfile': function(){
..
},
};
Service.GetData(function(data){
$scope.calculators.featured_photo = data.featured_photo;
$scope.myDz = $scope.dzMethods.getDropzone();
var mockFile = {serverImgUrl : $scope.calculators.featured_photo};
$scope.myDz.emit("addedfile", mockFile);
$scope.myDz.emit("success", mockFile);
$scope.myDz.emit("thumbnail", mockFile,
$scope.calculators.featured_photo);
$scope.myDz.createThumbnailFromUrl(mockFile, mockFile.serverImgUrl, null, true);
$scope.myDz.files.push(mockFile);
});
I had tried to look at the similar stackoverflow question in a non-angular way. But still have no idea.