Suppose I have
angular.module('clientApp').factory('CreditCardResource', function($resource) {
return $resource('/user/:userId/card/:cardId',
{cardId:'@id'}, {
charge: {method:'POST', params:{charge:true}}
});
});
I want to be able to have a CreditCardResource asociated to a certain userId, so that every time I call CreditCardResource.query() y get the cards related to that user. I dont want to call CreditCardResource.query({userId : 123}) every time. And I want the Resource to stay as a service.
I would like to do something like: CreditCardResource.defaultParams.userId = '123' in my controller.
What is the best way to aproach this problem?