Let's say we have a Person $resource that looks like this:
$scope.person = {
name: 'Max',
friends: [1, 2, 3]
}
If we Person.save($scope.person) to server, it would send the following parameters:
name: 'Max'
friends: '1'
friends: '2'
friends: '3'
So I will not have access to the array of friends on the server. Only its last element would be accessible.
What is the correct way of saving objects containing arrays to server using $resource?
p.s. I'm aware of a really hacky way, which is renaming friends attribute to friends[], but that's not solving my problem, as I have a lot of these and I can't go with redefining properties back and forth