title: Posting to WCF json endpoint with angular
body: <p>I am trying to post to a WCF json service endpoint from angular but have been unsuccessful in my attempts. I have verified the service is working by other means and working for the specified URL.</p>
  
  <p>Using firebug I can see the request being output as such:</p>
  
  <blockquote>
    <p>NetworkError: 400 Bad Request -
    <a href="http://www.myapi.com/V1/Service.svc/Authenticate?Password=password&amp;UserName=username" rel="nofollow">http://www.myapi.com/V1/Service.svc/Authenticate?Password=password&amp;UserName=username</a>"</p>
  </blockquote>
  
  <p>angular code</p>
  
  <pre><code>app.service('UserService', function ($http) {
  this.GetLoginStatus = function (AuthenticateRequest) {
      $http({
          url: APIURL + "/Authenticate",
          method: "POST",
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
          },
          params: AuthenticateRequest,
          data: {
              'Code': 'test data'
          }
      });
  };
  </code></pre>
  
  <p>});</p>
  
  <p>WCF Iservice</p>
  
  <pre><code>[WebInvoke(RequestFormat = WebMessageFormat.Json,
  ResponseFormat = WebMessageFormat.Json,
  Method = "POST",
  BodyStyle = WebMessageBodyStyle.Wrapped)]
  [OperationContract]
  AuthenticateResponse Authenticate(AuthenticateRequest Request);
  </code></pre>
  
  <p>Request definition</p>
  
  <pre><code>[DataContract]
  public class AuthenticateRequest
  {
      [DataMember]
      public String UserName { get; set; }
      [DataMember]
      public String Password { get; set; }
  }
  </code></pre>