Search Posts

Category: restangular

Restangular interceptor to handle $q.all request

I need help for Restangular interceptor. i can retry request all of the failed API calls but the data was not returned to the success method of the calling function. When not using $q.all, the interceptor was working fine. I need help how can I return the data. Below is my code for the interceptor: authrestangular.factory(“AuthRestangular”, function (Restangular, $q, $injector, $location, localStorageService, $filter, $timeout, cfpLoadingBar, $cookies) { return Restangular.withConfig(function(RestangularConfigurer) { RestangularConfigurer.addFullRequestInterceptor(function (element, operation, route, url, […]

AngularJS restangular post callback

I am using restangular with AngularJS, and I need to use some function, which will trigger callback function/promise after POST response. I tryed setResponseInterceptor which did not helped in this situation. I need to use this function to lock form from submission until response will come back to client, and then unlock it to future use. Do you know some magic for this? I am using this code, and want to fire custom function when […]

Wait for authentication response from server before executing any Angularjs app

I have an AngularJS app (bootstrapped using ng-admin) contained within an admin backend where initial login to it is handled via LDAP. When the Angular app loads for the first time, it needs to make an API call (using Restangular) to the server to fetch a token plus derive a separate API url to use. Once the token is returned, it’s stored in localStorage and then passed to all subsequent API calls. Because I’m not […]