Open ashgibson opened 9 years ago
I have the same problem:
var service = Restangular.withConfig(function(RestangularConfigurer) {
RestangularConfigurer.addElementTransformer('tasks', false, function(action_item) {
action_item.addRestangularMethod('addNotes', 'post', 'notes');
return action_item;
});
}).service('tasks')
// In my controller
$scope.task.addNotes([note]).then(function(task) {
console.log(task.getRequestedUrl());
console.log(task.getRestangularUrl());
// Both return myapi.com/notes not myapi.com/tasks
});
Same problem when directly using customGET(path)
.
Sorry for the long post, just wanted to provide as much info as possible.
I have a
ReportApiModule
and the following within therun
method.I then have a factory with that module called
ReportApi
where I return a serviceMyRestangular is another factory/service utilising the Restangular.withConfig as per the docs.
In my controller I do this:
This calls http://{mysite}/reports/service-report?from=2015-08-01&to=2015-08-31
I then want to have an export button that hits the same url buts append
&export=1
I was hoping I could create a function that looks like this:However both of these methods just return
http://{mysite}/reports
as the base url. getRequestedUrl() appends the params but not theservice-report
as per the custom method.Is this a bug or am I doing something incorrectly?