I have a page that supposed to create a new user object and post it to the server.
This is the html file:
<div class="container" ng-controller="newUserCtrl">
...
 <tr>
     <td>Username:</td>
     <td><input type="text" name="name" ng-value="user.username"></td>
 </tr>
 <tr>
     <td>Password:</td>
     <td><input type="text" name="name" ng-value="user.password"></td>
 </tr>
 <tr>
     <td>Name:</td>
     <td><input type="text" name="name" ng-value="user.name"></td>
 </tr>
...
</div>
This is the controller:
angular.module('module')
    .controller('newUserCtrl', ['$scope', '$http', '$location',
          '$state', newUserCtrl]);
function newUserCtrl($scope, $http, $location,
                        $state) {
    $scope.user = {
      usrename: null,
      password: null,
      name: null
  };
  $scope.saveNewUser = function() {
    var aa = $scope.user;
    $http.post('SERVICE URL', $scope.user)
      .then(doSomething);
  }
}
The problem that the data is not binded to the $scope.user object. I insert stuff, then after invoking the save methond I can see that aa is the initail user object.
How can I do that?
Regards, Ido
 
    