1

我在前端使用restangular,在后端使用python eve,示例模式如下所示

'notifications': {
    'type': 'dict',
    'schema': {
        'friend_requests': {
            'type': 'list',
            'schema': {
                'type': 'objectid',
                #'unique': True,
                'data_relation': {
                    'resource': 'people',
                    'embeddable': True
                }
            }
        },

      },
    },

我正在使用以下休息角度前端查询。

angular.module('weberApp')
.controller('UserprofileCtrl', function($scope, $routeParams, Restangular,
                                    InfinitePosts, CurrentUser,       UserService,FriendsNotific) {

$scope.UserService = UserService;
var user_obj = Restangular.one('people', $routeParams.username);

    user_obj.get().then(function(user) {
    $scope.user = user;

    $scope.addFriend = function() {
        $scope.user.patch(
            {

              "$push":  {"notifications":
                    {
                    "friend_requests":JSON.parse(CurrentUser.userId)
                    }
                }
            }
        ).then(function(data){
            console.log(data)
        });
    };
         });
 });

但上面的查询返回状态“ok”。但没有更新任何东西。如果有人知道请帮助我。

4

0 回答 0