FacultyCreative / ngActiveResource

Connects business objects and REST web services for Angular.js
255 stars 34 forks source link

Custom methods #39

Open killersite opened 10 years ago

killersite commented 10 years ago

Hi, Is there a facility to add a custom server connection method to an ngActiveResource Entity? for instance a more robust /search endpoint that could accept JSON POST payload of parameters (instead of the built-in where() call)? Also is there a way to push into the ngActiveResource object cache entities that were loaded with a different $http call?

thanks

andrejkaurin commented 10 years ago

I was just thinking about same since our API contains more calls than simple CRUD operations.

killersite commented 10 years ago

My original question is more about how in ngActiveResource would I add a $charge method similarly to what you can do with $resource below?

var CreditCard = $resource('/user/:userId/card/:cardId',
      {userId:123, cardId:'@id'}, {
       charge: {method:'POST', params:{charge:true}}
      });
sricc commented 10 years ago

+1