title: How to pass user defined objects to REST service from angularjs
body: <p>I am fairly new to Anuglar JS so please keep that in mind while answering this question. My goal here is to create and persist a new user in the oracle database. My frontend is written in AngularJS. A REST service (using JERSEY) is in place already with a method signature like below:</p>
  
  <pre><code> @POST
   @Path("/create/{user}")
   public void createUser(@QueryParam("user") User user){ ...}
  </code></pre>
  
  <p>AngularJS Factory with REST call looks like this:</p>
  
  <pre><code>angular.module('app.services', ['ngResource'])
  .factory('User', function($resource) 
   {
     return 
     {
          createUser: $resource('/myurl/create/:user', {}, {
              query: {
                  method: 'POST',
                  params: {user: '@user'},
                  isArray: false
              }
          })
     });
  </code></pre>
  
  <p>User.java has the following attributes:</p>
  
  <pre><code>private String firstName;
  private String lastName;
  private String email;
  </code></pre>
  
  <p>I believe the above factory is set up correctly. I have verified that the backend REST service for create user also works correctly. The frontend has a form that lets a user enter FirstName, LastName and Email which should be part of the User object. I think the User object should be submitted to the Rest service via something like:</p>
  
  <p>Step1: make an object with user's data
  Step2: User.createUser.query(user:)</p>
  
  <p>I am not sure if the steps are right and if they are then how exactly to make the object. Can someone please provide some guidelines. Thank you</p>