I want to reset my dropZone area by clicking reset button but I can not call resetDropzone function(in directivejs) from my controller. Can you help me please My directive.js is:
function dropZone() {
console.log("access");
return {
restrict: 'C',
link: function (scope, element, attrs) {
var config = {
url: 'http://localhost:8080/upload',
maxFilesize: 100,
paramName: "uploadfile",
maxThumbnailFilesize: 10,
parallelUploads: 1,
autoProcessQueue: false
};
var eventHandlers = {
'addedfile': function (file) {
scope.file = file;
if (this.files[1] != null) {
this.removeFile(this.files[0]);
}
scope.$apply(function () {
scope.fileAdded = true;
});
},
'success': function (file, response) {
}
};
dropzone = new Dropzone(element[0], config);
angular.forEach(eventHandlers, function (handler, event) {
dropzone.on(event, handler);
});
scope.processDropzone = function () {
dropzone.processQueue();
};
scope.resetDropzone = function () {
console.log("resetDropzon mthd");
dropzone.removeAllFiles();
};
}
}
}
I call this function from html code as ng-click="reset()" and my controller is:
$scope.reset = function () {
console.log("reset mthd");
$scope.resetDropzone();
};