angularjs - Alter $resource default methods -
how can alter , add default $resource return object methods?
the return object defaults in question (from docs):
a resource "class" object methods default set of resource actions optionally extended custom actions. default set contains these actions:
{ 'get': {method:'get'}, 'save': {method:'post'}, 'query': {method:'get', isarray:true}, 'remove': {method:'delete'}, 'delete': {method:'delete'} };
as understand, not follow restful principles in regard when use post , put. perhaps better have following methods:
{ 'get': {method:'get'}, 'save': {method:'put'}, 'create': {method:'post'}, 'query': {method:'get', isarray:true}, 'remove': {method:'delete'}, 'delete': {method:'delete'} };
is there way change default object $resource creates, not need alter each resource creating $resource?
i found talk @ ng-conf 2014 googles doubleclick team real answer question , beyond. create apiprovider uses , extends $resource.
they have github gist long include here.
Comments
Post a Comment