angular-JS模仿Form表单提交
发布时间:2020-12-16 08:55:00 所属栏目:asp.Net 来源:网络整理
导读:直接上示例代码,有不懂的欢迎留言: ? $http({ url: "http://localhost:10086/yuanxin/Conference/ImportExcelDataForBusRoute" ,method: 'Post' 'Content-Type': 'multipart/form-data' },data: { BusRoute: file,ConferenceID: "1" },transformRequest: f
直接上示例代码,有不懂的欢迎留言: ? $http({ url: "http://localhost:10086/yuanxin/Conference/ImportExcelDataForBusRoute",method: 'Post' },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( (data) { $scope.isSubming = false; $scope.BusRouteColl = data.dataList; $scope.pageIndex = 1; $scope.pageCount = data.pageCount; alert(data.property.mp); }).error( (ex,state) { alert(ex); console.log(state + ":" + ex.exceptionMessage); console.log(ex.stackTrace); $scope.isSubming = ; }); ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net – “共享主机中的”LOG_BACKUP“的数据库的事务日
- asp.net – 将MasterPage ImageButton事件传递给内容页面
- asp.net – Repeater的SeparatorTemplate与Eval
- asp.net – 通过Button控制Fire AsyncFileUpload
- asp.net-mvc – asp.net mvc – 子文件夹
- 维护面板滚动位置部分回传ASP.NET
- asp.net-mvc – 在asp.net mvc中的视图中设置页面标题,元信
- asp.net – 如何在x64中使用WebDev.WebServer.exe(VS Web S
- asp.net-mvc – 用户不在角色时的ASP.NET登录重定向循环
- 使用ASP.NET重定向到非www-url域?