![](/img/trans.png)
[英]How to get body of response by HTTP POST request via library request
[英]Get the http post request body AngularJS
我想知道如何在AngularsJS中获取HTTP POST请求的正文。
事实是,我有一个网站将一个http请求发布到mywebsite,其中包含我想在我的有角度的应用程序中获取和处理的正文中的信息。
有人有解决方案吗? 在角度上,我仅成功获得了请求的参数,但没有成功获得主体。
谢谢。
您可以在浏览器控制台中打印完整的请求和响应。
angular.module('interceptors.httpInterceptors',[])
.factory('httpInterceptors', [function () {
return {
request: function (config) {
console.log(angular.toJson(config));
return config;
},
response: function (response) {
console.log(angular.toJson(response));
},
responseError: function(rejection) {
}
};
}])
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push('httpInterceptors');
}]);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.