Angular JS Restangular:如何使用id数组作为请求体删除多个记录?

时间:2014-09-29 12:05:50

标签: node.js angularjs restangular

Restangular.remove()函数将请求对象作为查询参数发送(例如:/ users?ids = 1& ids = 2& ids = 3),而不是将这些ID作为正文参数(JSON格式)发送

示例代码:

$scope.users = {};
$scope.myIds = ['1','2','3'];
$scope.users.ids = $scope.myIds;
var baseUsers = Restangular.all('users');
baseUsers.remove($scope.users).then(function(data){
console.log("Rsp Data :", data);
};

如何将此数组 $ scope.users 作为请求正文发送..?

0 个答案:

没有答案