国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

AngularJS模仿Form表單提交的實(shí)現(xiàn)代碼

Original 2016-12-26 16:31:15 1009
abstract:本文通過一段實(shí)例代碼給大家簡單介紹了angularjs模仿form表單提交的方法。$http({ url: "http://localhost:10086/yuanxin/Conference/ImportExcelDataForBusRoute", method: 'Post', headers: { 'Content-T

本文通過一段實(shí)例代碼給大家簡單介紹了angularjs模仿form表單提交的方法。

$http({
url: "http://localhost:10086/yuanxin/Conference/ImportExcelDataForBusRoute",
method: 'Post',
headers: {
'Content-Type': 'multipart/form-data'
},
data: { BusRoute: file, ConferenceID: "1" },
transformRequest: function (data, headersGetter) {//進(jìn)行格式轉(zhuǎn)換,非常關(guān)鍵
var formData = new FormData();//將model轉(zhuǎn)為表單格式
angular.forEach(data, function (value, key) {
formData.append(key, value);
});
var headers = headersGetter();
DELETE headers['Content-Type'];
return formData;
}
}).success(function (data) {
$scope.isSubming = false;
$scope.BusRouteColl = data.dataList;
$scope.pageIndex = 1;
$scope.pageCount = data.pageCount;
//alert(data.property.mp);
}).error(function (ex, state) {
alert(ex);
console.log(state + ":" + ex.exceptionMessage);
console.log(ex.stackTrace);
$scope.isSubming = false;
});

更多關(guān)于AngularJS模仿Form表單提交的實(shí)現(xiàn)代碼請關(guān)注PHP中文網(wǎng)(www.miracleart.cn)其它文章!

Release Notes

Popular Entries