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。您可以选择设置参数、标题和元素。元素是要发布的元素。如果未设置,则假定调用此函数的是元素本身
stuffResource = parentResource
.one(resources.category, $scope.stuff.category)
.one(resources.stuff, $scope.stuff.id)
.customPUT($scope.stuff);