0
私は、アレイは、私は返信約束はangularjsでエラーを示していますか?
uploadPicture: function (files,title) {
if (!files)
promise = function(){}
return promise;
angular.forEach(files, function (file) {
if (file && !file.$error) {
promise = $upload.upload({
url: "https://api.cloudinary.com/v1_1/" + cloudinary.config().cloud_name + "/upload",
data: {
upload_preset: cloudinary.config().upload_preset,
tags: 'myphotoalbum',
context: 'photo=' + title,
file: file
}
}).progress(function (e) {})
.success(function (data, status, headers, config) {
return data;
}).error(function (data, status, headers, config) {
return data;
});
}
});
return promise;
}
}
以下の実行$ HTTP call.Myコードファイルがnullの場合、それはエラー
を示しせずに機能を返すことができますどのように空になったときcloudinary.Butに、アレイからの画像をアップロードサービスを持っています私controolerでdelregservice.uploadPicture(...).then is not a function
$scope.Fn_SaveDeliveryAgent = function(){
delregservice.uploadPicture($scope.filelist[0],$scope.title).then(function(d){
$scope.delAgent.profile_pic = d;
}).then(function(){
delregservice.uploadPicture($scope.filelist[1],$scope.title).then(function(d){
$scope.delAgent.license_pic = d;
}).then(function(){
delregservice.saveDeliveryAgent($scope.delAgent).then(function(d){
console.log(d);
});
});
});
}
どのように私はこの問題を解決することができますか?助けてください。事前に気に入っているXマス
を返すことを保証し、I新しい約束の下でupdloadをenvolvedしました。アップロードは約束ではありません。これかもしれない –