title: change Content-type to "application/json" POST method, RESTful API
body: <p>I am new at AngularJS and I needed your help.</p>
  <p>All I need just need is to POST my json to the API and recieve the proper response.</p>
  <p>Here's my JSON where i don't know where to code this.</p>
  <p><strong>JSON</strong></p>
  <pre><code>{ 
      &quot;userId&quot;      :&quot;testAgent2&quot;,
      &quot;token&quot;       :&quot;testAgent2&quot;,
      &quot;terminalInfo&quot;:&quot;test2&quot;,
      &quot;forceLogin&quot;  :&quot;false&quot;
  }
  </code></pre>
  <p>NOT SURE IF I'm doing this right.</p>
  <p><strong>CONTROLLER.JS</strong></p>
  <pre><code>function UserLoginCtrl($scope, UserLoginResource) {
      //Save a new userLogin
      $scope.loginUser = function() {
          var loggedin = false;
          var uUsername = $scope.userUsername;
          var uPassword = $scope.userPassword;
          var uforcelogin = 'true';
  
          UserLoginResource.save();
      }
  }
  </code></pre>
  <p><strong>SERVICES.JS</strong></p>
  <pre><code>angular.module('UserLoginModule', ['ngResource'])
      .factory('UserLoginResource', function($resource, $http) {
          $http.defaults.useXDomain = true;
          delete $http.defaults.headers.common['X-Requested-With'];
          $http.defaults.headers.post[&quot;Content-Type&quot;] = &quot;application/json&quot;; //NOT WORKING
  
          return $resource('http://123.123.123.123\\:1234/SOME/LOCATION/THERE', {}, {
              save: { 
                  method:'POST', 
                  headers: [{'Content-Type': 'application/json'}] 
              } //NOT WORKING EITHER
          });
      });
  </code></pre>
  <p><strong>INDEX.HTML</strong></p>
  <pre><code>&lt;html ng-app&gt;
  
  &lt;head&gt;
  &lt;script src=&quot;js/lib/angular/angular.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;js/lib/angular/angular-resource.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  
  &lt;body ng-controller=&quot;UserLoginCtrl&quot;&gt;
    
  &lt;form class=&quot;form-horizontal&quot; name=&quot;form-horizontal&quot; ng-submit=&quot;loginUser();&quot;&gt;
  
  &lt;div class=&quot;button-login&quot;&gt;
  
  &lt;!-- start: button-login --&gt;
  &lt;button class=&quot;btn btn-primary&quot; type=&quot;submit&quot;&gt;Login&lt;/button&gt;
  
  &lt;/div&gt;
  
  &lt;/form&gt;
  
  
  &lt;/body&gt;   
  
  
  &lt;/html&gt;
  </code></pre>
  <p>I kept on getting a response like Unsupported Media Type. I don't know, what else to do.</p>