I am new to angular js, loopback and nodejs,
While implementing the authentication in the angular app, I am getting the below mentioned error
Uncaught Error: [$injector:unpr] Unknown provider: sessionInjectorProvider <- sessionInjector <- $http <- $compile
I was going through this document, but no help. http://www.webdeveasy.com/interceptors-in-angularjs-and-useful-examples/
This error came when I added the below lines for sessionInjector
angular.module('myApp', []).factory('sessionInjectorProvider', ['SessionService', function(SessionService) {
var sessionInjector = {
request: function(config) {
if (!SessionService.isAnonymus) {
config.headers['x-session-token'] = SessionService.token;
}
return config;
}
};
return sessionInjector;
}]);
angular.module('myApp', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push('sessionInjector');
}]);