Wie kann man den Fortschritt mit eventHandlers und uploadEventHandlers in anglejs 1.5.5 mit $ http oder $ resource verfolgen?
Ich versuche, mich strikt an AngularJS-Code zu halten, indem ich $ http oder $ resource verwende, um Dateien hochzuladen.
var uploadData = new FormData();
uploadData.append('file', obj.lfFile);
var fileData = angular.toJson({
'FileName': obj.lfFile.name,
'FileSize': obj.lfFile.size
});
uploadData.append('fileData', fileData)
$http({
method: 'POST',
url: vm.uploadPath,
headers: {
'Content-Type': undefined,
'UserID': vm.folder.UserID,
'ComputerID': vm.folder.ComputerID,
'KeepCopyInCloud': vm.keepCopyInCloud,
'OverWriteExistingFile': vm.overwriteExistingFile,
'RootFileID': vm.folder.RootFileID,
'FileName': obj.lfFile.name,
'FileSize': obj.lfFile.size
},
eventHandlers: {
progress: function(c) {
console.log('Progress -> ' + c);
console.log(c);
}
},
uploadEventHandlers: {
progress: function(e) {
console.log('UploadProgress -> ' + e);
console.log(e);
}
},
data: uploadData,
transformRequest: angular.identity
}).success(function(data) {
console.log(data);
}).error(function(data, status) {
console.log(data);
console.log(status);
});
Die Events werden überhaupt nicht ausgelöst. Was vermisse ich
Verweis
https: //github.com/angular/angular.js/issues/1443https: //github.com/angular/angular.js/pull/1154