2015-11-04 24 views
0

这是我的API'/ api/comments/{id}'在Restangular调用PUT API

上面的API需要id以及json数据。

我试过下面的代码,但它似乎并没有工作。

Restangular.one('api/comments/'+commentUID).put($scope.updateCommentData).then(function (responseData){ 

         }); 

我需要发送请求有效载荷与认沽呼叫

$scope.updateCommentData = { 
          "CommentUID": commentUID, 
          "AssetUID": $scope.currentAsset.AssetUID, 
          "Note":note, 
          "VisibilityEnum": 2, 
          "Ver": version 
         }; 

任何一个可以帮助我...

回答

0

你可以尝试这样的

Restangular.one('api/comments', commentUID).put($scope.updateCommentData).then(function (responseData){ 

        }); 

这里链接https://github.com/mgonto/restangular

+0

您可以请检查控制台/网络中调用的网址 –

+0

这可能有助于http://jsfiddle.net/merlinran/8fvGh/ –

+0

在控制台中调用正确的URL,但它给了我错误的请求错误。 –