Search code examples
angularjsputrestangular

restangular put sending object to url and not the body?


hello i am new to angularjs, i have a probleme when doing a PUT

$scope.submitProfile = function () {
      Restangular.one('user/me').put().then(function(results){
        results.username = "toto";
      }).error(function(){
        console.log("error");
      });
     };

what i want is send, like username = "toto" and this should change the username to toto any help ! and another thing is the object i send should not go the url but to the body

the code i posted works but in the body nothing is send


Solution

  • Try customPut

    Restangular.one('user/me').customPUT(userObject).then(function(response){
      //Do your stuff here
    })