我正在使用" angular-file-upload"来自https://github.com/nervgh/angular-file-upload。 在我的HTML中,我有......
<div ng-controller="UploadCtrl" uploader="uploader" options="{recordid:model.id}">
从我读过的文件......
属性选项可以是{FileItem}选项或自定义 属性。
到目前为止一切顺利 - 但我如何检索选项对象?当我在上传器对象上执行console.log()时,我发现的最多是这个:
//console output from console.log(uploader)
uploader.filters[0].name='recordid';
uploader.filters[0].fn=function(a) {...}
这是我的控制器
app.controller('UploadCtrl2', ['$rootScope', '$scope', 'FileUploader', 'Store',
function ($rootScope, $scope, FileUploader, Store) {
var uploader = $scope.uploader = new FileUploader({
url: 'upload.php'
formData:[]
});
uploader.onBeforeUploadItem = function (item, options) {
console.log(uploader);
};
(...)
});