Angularjs 如何在angular dropzone指令中集成动态URL
我正在使用 angularjs中的文件上载代码。 这里是角下降区的链接-- 我想上传多路径的文件。如何为动态url配置drozone指令 这是下降区指令Angularjs 如何在angular dropzone指令中集成动态URL,angularjs,dropzone.js,Angularjs,Dropzone.js,我正在使用 angularjs中的文件上载代码。 这里是角下降区的链接-- 我想上传多路径的文件。如何为动态url配置drozone指令 这是下降区指令 appControllers.directive('dropzone', dropzone); function dropzone(){ return function(scope, element, attrs) { var config = { url : "api/company/logo/1",--->
appControllers.directive('dropzone', dropzone);
function dropzone(){
return function(scope, element, attrs) {
var config = {
url : "api/company/logo/1",--->i want this url dynamically
maxFilesize: 100,
paramName: "uploadfile",
maxThumbnailFilesize: 10,
parallelUploads: 1,
autoProcessQueue: true
};
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() {
dropzone.removeAllFiles();
}
}}
指令代码:
scope.processDropzone = function(url) {
dropzone.options.url = url;
dropzone.processQueue();
};
从控制器:
$scope.processDropzone("http://localhost:8080/my/custom/upload");