restangular icon indicating copy to clipboard operation
restangular copied to clipboard

Use custom methods with decoupled service

Open gkpo opened this issue 10 years ago • 4 comments

I'm using a Decoupled Restangular service for consuming my API:

// Declare factory
module.factory('Users', function(Restangular) {
  return Restangular.service('users');
});

I'd like to call a custom method on my resource: /users/active The documentation says I can do it like so:

// GET /users/active
Restangular.all("users").customGET("active")

However, I'd like to use the service I created before, rather than redeclaring a restangular resource 'users', which wouldn't be completely "DRY".

I'd like to do something like:

Users.customGET("active")

But I get an error TypeError: Clientfile.customGET is not a function.

gkpo avatar Jun 05 '15 14:06 gkpo

+1

fracz avatar Oct 02 '15 08:10 fracz

+1

yasar avatar Jan 20 '16 16:01 yasar

+1

freshsun avatar Jan 09 '17 08:01 freshsun

+1

stefanosalvucci avatar Sep 05 '17 13:09 stefanosalvucci