title: How to set header to the $http.post method AngularJS 1.3.5?
body: <p>I wrote a rest webservice and to avoid the error I got in my java code which is:
  The registered message body readers compatible with the MIME media type, I have to add to my $http.post a  'Content-Type': 'application/x-www-form-urlencoded' or  'Content-Type': 'application/json'.
  I am using Angularjs 1.3.5 and whenever I tried to add the headers {content-type.... }, I failed. What can I do exactly to solve my problem?
  <div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$scope.save = function(url,data) {
      var data_stack = $scope.stack;
    $http.post(url, data_stack)
              .then(
             function(response){
                  }, 
             function(response){
                  });
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form ng-submit="save()"&gt;
        &lt;input ng-model="stack"&gt;&lt;/input&gt;
        &lt;button type="submit"&gt;Save&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>