var app = angular.module('maplePointApp',[]);
app.config(["$httpProvider",function ($httpProvider) {
//更改 Content-Type
$httpProvider.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded;charset=utf-8";
$httpProvider.defaults.headers.post["Accept"] = "*/*";
$httpProvider.defaults.transformRequest = function (data) {
//把JSON数据转换成字符串形式
if (data !== undefined) {
return $.param(data);
}
return data;
};
}])
app.controller('myCtr',function($scope,$http) {
$scope.initIndex = function () {
$http({
method : "post", url : "${REQ}/maple/point", data : {
"id" : 123
}
}).success(function(rs) {
console.log(rs)
$scope.dataList=rs;
}).error(function(rs) {
});
}
});
原文链接:https://www.f2er.com/angularjs/146852.html