I have the following code:
function configRestangular(RestangularProvider, BASE_URL) {
RestangularProvider.setBaseUrl(BASE_URL);
RestangularProvider.setDefaultHeaders({ 'Content-Type': 'application/json' });
RestangularProvider.setErrorInterceptor(
function (response, deferred) {
if (response.status === 401 || response.status === 403) {
}
});
}
core.config(configRestangular);
When I pass $localStoragefunctions configRestangular(RestangularProvider, BASE_URL), the application throws an exception.
Unprepared error: [$ injector: modulerr] Could not create module application because of: Error: [$ injector: modulerr] Could not create instance of app.core module because of: Error: [$ injector: unpr] Unknown provider: $ localStorage http://errors.angularjs.org/1.4.0-rc.2/ $ injector / unpr? p0 =% 24localStorage
I registered the module ngStoragein the main module. The file is ngStorage.jsalso added on my main page. The service $localStorageruns on all controllers except this configuration.
https://github.com/gsklee/ngStorage localStorage.