问题
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