all actions for a AngularJS $resource are added as $customAction methods to the Resource so that I can invoke them as methods on resource instances, e.g.:
var User = $resource('/user/:userId', {userId:'@id'});
User.get({userId:123}, function(user) {
user.abc = true;
user.$save();
});
$save is the save action and can be called on the user instance.
I now defined the following custom action, leading to a $attributes method on every instance of user:
var User = $resource('/user/:userId', {userId:'@id'}, {
attributes: { method: 'GET', url: '/user/:userId/attributes', isArray: true }
});
If I now try to invoke this method, I get the error Object #<Resource> has no method 'push':
User.get({userId:123}, function(user) {
var attrs = user.$attributes(); // error
// ...
});
Did I get the concept of custom actions wrong?