将对象放在重新排列中 [英] Put Object in Restangular
本文介绍了将对象放在重新排列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您会在我的代码下方看到使用 retangular 更改我的数据库中的记录.
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:添加或获取没有其他问题.
ps: no other issue with adding or getting.
推荐答案
你应该在 then 函数中做,
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();
})
这篇关于将对象放在重新排列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文