角度资源放置请求与数组像params

时间:2015-06-18 17:46:06

标签: angularjs angular-resource

我必须使用角度资源重新创建以下网址,但我一直在努力,不能这样做:

my_domain / plan_memberships / 24 =的access_token {{}的access_token}&安培; plan_membership [存档] = 1

问题是plan_membership [archived] = 1 我只得到plan_membership =已存档:1我似乎无法找到办法。 我的资源如下:

.factory('deleteFromPlan', ['$resource', function ($resource){
    return $resource(
            angularConfig.rootApiEndpoint + '/me/plans/:plan_slug/plan_memberships/:membership_id',
            {//param defaults
                plan_slug: '@plan_slug',                        
                token: '@access_token',
                membership_id: '@membership_id',
                plan_membership: '@plan_membership[archived]'
            },
            {
                'update': {
                    method: 'PUT'                                                   
                }
            }
        );
}])

我正在使用它:

deleteFromPlan.update({
        access_token: $rootScope.angularConfig.user.access_token,
        plan_slug: sharedVars.getPlanId(),
        membership_id: membershipId,
        plan_membership: { archived: 1 }},
        function(data){
            console.log(data);
            spinner.hideActionLoader(overlay);  
            $scope.showOptionsModalMembers = false;  
    });

当我这样做时,我得到这个网址:

http://localhost:3000/api/v1/me/plans/1/plan_memberships/10?plan_membership=%7B%22archived%22:1%7D&token=111111

当我得到这个时:

http://localhost:3000/api/v1/me/plans/1/plan_memberships/10?plan_membership[archived]=1&token=111111

我还需要做些什么吗?它也是一个PUT请求

提前致谢!

0 个答案:

没有答案