Is there a way to retrieve the URL and parameters from an ng-resource object?
If not, what are some strategies for creating a custom wrapper or extending ng-resource to achieve this functionality?
Update: My goal is to extract the URL and params from the resource object without making an actual request.
In an ideal scenario, I would like the following to work:
myResource = $resource('localhost/foo/bar');
myResource.getUrl() // returns localhost/foo/bar
Since the getUrl function doesn't exist, I attempted a solution mentioned in
An example of using a wrapping factory:
angular.module('app').factory('ExtendedResourceFactory',['$resource',
function($resource) {
function ExtendedResourceFactory() {
var Resource = $resource.apply(this, arguments);
Resource.prototype.getArguments = function() {
return arguments
};
return Resource;
}
return ExtendedResourceFactory;
}
]);
I integrated the new factory and tested it:
res = ExtendedResourceFactory('url')
res.getArguments()
Uncaught TypeError: res.getArguments is not a function(…)
Any suggestions or solutions would be greatly appreciated!