After developing a REST webservice, I encountered an error in my Java code related to MIME media types. To resolve this issue, I attempted to include 'Content-Type': 'application/x-www-form-urlencoded' or 'Content-Type': 'application/json' in my $http.post request when using AngularJS 1.3.5. Unfortunately, I was unsuccessful in adding these headers correctly. Can anyone provide guidance on how to effectively address this problem?
$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>