當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
angular-JS模仿Form表单提交
生活随笔
收集整理的這篇文章主要介紹了
angular-JS模仿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) {//進行格式轉換,非常關鍵var formData = new FormData();//將model轉為表單格式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; });?
轉載于:https://www.cnblogs.com/lxhbky/p/6145008.html
總結
以上是生活随笔為你收集整理的angular-JS模仿Form表单提交的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 无界限设计加持!魅族手环正式亮相
- 下一篇: jquery在ie浏览器下中文乱码的问题