【问题标题】:restangular put sending object to url and not the body?restangular 将发送对象发送到 url 而不是正文?
【发布时间】:2017-06-24 11:04:10
【问题描述】:

你好,我是 angularjs 新手,我在做 PUT 时遇到了问题

$scope.submitProfile = function () {
      Restangular.one('user/me').put().then(function(results){
        results.username = "toto";
      }).error(function(){
        console.log("error");
      });
     };

我想要的是发送,例如用户名 =“toto”,这应该将用户名更改为 toto 任何帮助! 另一件事是我发送的对象不应该去 url 而是去 body

我发布的代码有效,但在正文中没有发送任何内容

【问题讨论】:

    标签: angularjs put restangular


    【解决方案1】:

    试试customPut

    Restangular.one('user/me').customPUT(userObject).then(function(response){
      //Do your stuff here
    })
    

    【讨论】:

      猜你喜欢
      • 2013-11-16
      • 1970-01-01
      • 1970-01-01
      • 2020-04-03
      • 2012-10-18
      • 1970-01-01
      • 2012-02-09
      • 1970-01-01
      • 2015-03-27
      相关资源
      最近更新 更多