-
Notifications
You must be signed in to change notification settings - Fork 833
Open
Description
I am currently trying to implement ng-admin with a Loopback API. As Loopback provides collection length in a separate route (/api/cars/count), I would like to decorate the response with a totalCount property retrieved from this URL.
Here is what I've done so far:
app.run(['Restangular', '$http', function(RestangularProvider, $http) {
RestangularProvider.addResponseInterceptor(function(data, operation, what, url, response, deferred) {
if (operation !== 'getList') {
deferred.resolve(data);
}
$http.get(url + '/count')
.success(function(countData) {
response.totalCount = countData.count;
deferred.resolve(data);
})
.error(function(error) {
deferred.reject(error);
});
});
}]);Does Restangular interceptor deals correctly with asynchronous tasks?
Probably related to #893.
Metadata
Metadata
Assignees
Labels
No labels