Put Object in Restangular

220 views Asked by At

You see below my code to change a record from my db using restangular.

Restangular.one("/mywebsite/bin/server.fcgi/REST/players", "70").get().then(function(c){
          $scope.content = c;
        })

        $scope.content.Name= "Asqan";

        $scope.content.put();

when i try to put as the last line of my code, it gives the error:

PUT http://localhost/mywebsite/bin/server.fcgi/REST/players 404 (Object not found)

ps: no other issue with adding or getting.

1

There are 1 answers

1
Debasish Mohapatra On

you should do it in the then function,

Restangular.one("/mywebsite/bin/server.fcgi/REST/players", "70").get().then(function(c){

      $scope.content = c;
      $scope.content.Name= "Asqan";
      $scope.content.put();
})