restangular
restangular copied to clipboard
Use custom methods with decoupled service
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.
+1
+1
+1
+1