【发布时间】:2015-08-03 07:43:40
【问题描述】:
如何将我的两个 $http.post 合并为一个 http post?
$scope.myMethod = function(){
var fd = new FormData();
angular.forEach($scope.files, function(file){
fd.append('file', file);
});
$http.post('my_url', fd, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
}).success(function(result){
console.log(result);
});
$http.post('my_url', {imgx: $scope.imgx, imgy: $scope.imgy, imgh: $scope.imgh, imgw: $scope.imgw}).success(
function(data){
console.log(data);
});
}
非常感谢任何帮助,谢谢
【问题讨论】:
标签: jquery angularjs http-headers form-data