title: Angularjs - 500 (Internal Server Error) on $http Post
body: <p>I am new to Ionic and angular. I am building a sample with ionic framework using angular.js. I want to call WebApi through $http post method. I checked this(<a href="https://github.com/driftyco/ionic-proxy-example" rel="nofollow">ionic-proxy-example</a>) solution and I am trying to implement the same using my api. When I call the api provided in above example in my sample project, I get the records but its not working with my api. It throws 500 internal error. </p>
  
  <p>Here is my app.js</p>
  
  <pre><code>angular.module('myApp', ['myApp.controllers', 'myApp.services'])
  .constant('ApiEndpoint', {url: 'http://localhost:8100/api'})
  </code></pre>
  
  <p>Services.js</p>
  
  <pre><code>angular.module('myApp.services', [])
  .factory('Api', function($http, $q, ApiEndpoint) {
  
  
  console.log('ApiEndpoint', ApiEndpoint)
  
   var getApiData = function() {
  var q = $q.defer();
  
          var data = {
              Gameweek_ID: '179',
              Vender_ID: '1',
              Language:'en'
          };
  
           var config = {
              headers : {
                  "Content-Type": "application/json; charset = utf-8;"
              }
          };
  
          $http.post(ApiEndpoint.url, data, config)
          .success(function (data, status, headers, config) {
             // $scope.PostDataResponse = data;
                alert('success');
                console.debug("response :" + data);
                q.resolve(data);
          })
          .error(function (data, status, header, config) {
              // $scope.ResponseDetails = "Data: " + data +
                alert('error');
                console.debug("error :" + data);
                q.reject(data);
          });
  
  
  return q.promise;
  
  
   }
  
   return {getApiData: getApiData};
  })
  </code></pre>
  
  <p>controllers.js</p>
  
  <pre><code>angular.module('myApp.controllers', [])
  .controller('Hello', function($scope, Api) {
   $scope.employees = null;
  Api.getApiData()
  .then(function(result) 
  {console.log("result is here");
  jsonresponse = result.data;
  $scope.employees = jsonresponse;}
  )
  </code></pre>
  
  <p>});</p>
  
  <p>And Ionic.Project File</p>
  
  <pre><code>{
  
  
  "name": "Multilingual",
  "app_id": "4b076e44",
  "proxies": [
  {
    "path": "/api",
    "proxyUrl": ""
  }
  ]}
  </code></pre>
  
  <p>I am trying to understand the problem and checked multiple methods to call the api. Surprisingly, it works with ajax post call without any CORS errors. As I am using Angular, I am trying to get this done through $http post. I feel it is some minor issue but I am not able to figure out. Will be grateful for solutions. Thank you.</p>