Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Restangular-PUT请求负载作为查询字符串参数发送_Javascript_Angularjs_Put_Restangular - Fatal编程技术网

Javascript Restangular-PUT请求负载作为查询字符串参数发送

Javascript Restangular-PUT请求负载作为查询字符串参数发送,javascript,angularjs,put,restangular,Javascript,Angularjs,Put,Restangular,我用的是矩形,有这样的东西: stuffResource = parentResource .one(resources.category, $scope.stuff.category) .one(resources.stuff, $scope.stuff.id) .put($scope.stuff); 现在,当发送请求时,我的“stuff”对象将在查询字符串中而不是正文中发送 我做错了什么?您想在这里做的是使用customPUT()

我用的是矩形,有这样的东西:

stuffResource = parentResource
          .one(resources.category, $scope.stuff.category)
          .one(resources.stuff, $scope.stuff.id)
          .put($scope.stuff);
现在,当发送请求时,我的“stuff”对象将在查询字符串中而不是正文中发送


我做错了什么?

您想在这里做的是使用customPUT()而不是普通的put()

从文件中

  • put([queryParams,headers]):对当前元素执行put操作

  • customPUT([elem,path,params,headers]):对特定路径执行PUT。您可以选择设置参数、标题和元素。元素是要发布的元素。如果未设置,则假定调用此函数的是元素本身


谢谢@Joshua\u Kelly!我用customPUT实现了它,但是,这种方式很可怕,因为用请求负载进行PUT是非常正常的。这应该是默认值!
stuffResource = parentResource
    .one(resources.category, $scope.stuff.category)
    .one(resources.stuff, $scope.stuff.id)
    .customPUT($scope.stuff);