Currently, I am utilizing a RestangularProvider to implement an $http interceptor for injecting an authentication header into all restangular requests. However, I have encountered an issue where I cannot inject services into app.config(), preventing me from accessing the angular local storage necessary for storing the token obtained from the login server.
angular.module('app').config(function(RestangularProvider, localStorageService) {
RestangularProvider.setBaseUrl('/api/');
RestangularProvider.setFullRequestInterceptor(function(element, operation, route, url, headers, params, httpConfig) {
var authData = localStorageService.get('authorizationData');//ERROR:localStorageService doesn't exist
};
});
The "authorizationData" serves as my locally stored authentication token. It's clear that both the Restangular provider and local storage are essential for my application. If anyone has any suggestions or workarounds, I would greatly appreciate it. Thank you!