I have a disabled relay service to which I would like to add a special method. Apparently, the only methods returned by default in the collection are getList , one and post . I would like to do Locations.getLongLat()
I tried adding the following to my service with no luck (the method is not bound to an object) and I just get undefined is not an object in response.
angular.module('myApp') .factory('Locations', function (Restangular) { return Restangular.withConfig(function (RestangularConfigurer) { RestangularConfigurer.addElementTransformer('api/v1/locations', true, function (location) { location.addRestangularMethod('getLongLat', 'get', 'longlat'); return location; }); }).service('api/v1/locations'); })
Does anyone have any idea?
angularjs angularjs-service restangular
David wadge
source share