标签:provider one amp mod span encodeuri http transform encode
app上加上配置相关的代码即可
var myApp = angular.module(‘myApp‘,[]); myApp.config(function($httpProvider){ $httpProvider.defaults.transformRequest = function(obj){ var str = []; for(var p in obj){ str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); } return str.join("&"); } $httpProvider.defaults.headers.post = { ‘Content-Type‘: ‘application/x-www-form-urlencoded‘ } });
Angular JS 1.X 接口拿不到 http post 请求的数据
标签:provider one amp mod span encodeuri http transform encode
原文地址:https://www.cnblogs.com/lyc94620/p/9675897.html