【发布时间】:2016-10-07 10:13:23
【问题描述】:
我写了一个rest webservice,以避免我在java代码中遇到的错误: 注册的消息正文阅读器与 MIME 媒体类型兼容,我必须在我的 $http.post 中添加一个 'Content-Type': 'application/x-www-form-urlencoded' 或 'Content-Type': 'application/ json'。 我正在使用 Angularjs 1.3.5,每当我尝试添加标题 {content-type.... } 时,我都失败了。我能做些什么来解决我的问题?
$scope.save = function(url,data) {
var data_stack = $scope.stack;
$http.post(url, data_stack)
.then(
function(response){
},
function(response){
});
}
<form ng-submit="save()">
<input ng-model="stack"></input>
<button type="submit">Save</button>
</form>
【问题讨论】:
标签: javascript angularjs