把对象在Restangular [英] Put Object in Restangular

查看:120
本文介绍了把对象在Restangular的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您看到下面我的code。使用restangular从我的数据库更改记录。

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

当我试图把我的code的最后一行,它提供了错误:

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.

推荐答案

你应该这样做在当时的功能,

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

这篇关于把对象在Restangular的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆