AngularJs 在表单发送中调用函数
AngularJs invoke a function in form sending
我有一个具有上传文件功能的表单。上传功能已经删除,想法是将图片与其他表单数据一起上传到后端。
var uploaderImages = $scope.uploaderImages = new FileUploader({
url: '/api/productimg'
});
$scope.addProducts = function(){
ProductApi.addProduct($scope.product)
.then(function(response){ -----> form data has been saved!!
uploaderImages() ----> invoke this cause an error
})
.catch(function(response){
console.log(response.data);
})
}
谢谢!!
var uploaderImages = $scope.uploaderImages = new FileUploader({
url: '/api/productimg'
});
uploaderImages
是一个对象。你不能像函数一样调用它。请参阅 FileUploader
的文档以找到适当的调用方法。
我有一个具有上传文件功能的表单。上传功能已经删除,想法是将图片与其他表单数据一起上传到后端。
var uploaderImages = $scope.uploaderImages = new FileUploader({
url: '/api/productimg'
});
$scope.addProducts = function(){
ProductApi.addProduct($scope.product)
.then(function(response){ -----> form data has been saved!!
uploaderImages() ----> invoke this cause an error
})
.catch(function(response){
console.log(response.data);
})
}
谢谢!!
var uploaderImages = $scope.uploaderImages = new FileUploader({
url: '/api/productimg'
});
uploaderImages
是一个对象。你不能像函数一样调用它。请参阅 FileUploader
的文档以找到适当的调用方法。