title: Posting with Angular to Mongo
body: <p>My setup is NodeJS, MongoDB, and Angular. I'm currently trying to add POSTing capability to my test code but can't quite wrap my head around it. Currently I can pull data from the DB and I threw together a quick and dirty form/factory based on a number of examples I've seen to try to get the POST function working. </p>
  
  <p>The problem I'm running into is actually getting the values to be added to the DB. When I submit the form, a new ObjectID is created in the DB with a "_v" field and a value of 0. So I know the POST is at least being sent to the DB, but the values I want are not. I'm sure I'm doing something stupid and any help is greatly appreciated.</p>
  
  <p><strong>Here is my controller/factory setup:</strong> (I named the POST factory "taco" so it would stand out. Also because they're delicious.)</p>
  
  <pre><code>      angular.module('app', ['ngRoute'])
       .factory('Users', ['$http', function($http) {
          return $http.get('/users');
       }])
      .factory('taco', ['$http', function($http) {
          return $http.post('/users');
       }])
       .controller('UserController', ['$scope', 'Users', function($scope, Users) {
          Users.success(function(data) {
              $scope.users = data;
          }).error(function(data, error) {
              console.log(error);
              $scope.users = [];
          });
       }])
       .controller('ExampleController', ['$scope', 'taco', function($scope, taco) {
       $scope.submit = function() {
        if ($scope.users.name) {
        $scope.name.post(this.name);
        $scope.name = '';
      }
    };
  }]);
  </code></pre>
  
  <p><strong>Here is my form:</strong></p>
  
  <pre><code>&lt;div&gt;
     &lt;form ng-submit="submit()" ng-controller="ExampleController"&gt;
        Enter the things:&lt;br/&gt;
        &lt;input type="text" ng-model="name" name="user.name" placeholder="name" /&gt;&lt;br/&gt;
        &lt;input type="text" ng-model="emp_id" name="user.emp_id" placeholder="EID" /&gt;&lt;br/&gt;
        &lt;input type="text" ng-model="loc" name="user.loc" placeholder="location" /&gt;&lt;br/&gt;
        &lt;input type="submit" id="submit" value="Submit" /&gt;
     &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>