Put Object in Restangular

喜你入骨 提交于 2019-12-13 08:02:27

问题


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:


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();
})


来源:https://stackoverflow.com/questions/30841411/put-object-in-restangular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!