0
I’m trying to implement an authentication system with Angular + json web token, but when I try to make one $http.interceptors.push('nomeDo Interceptor')
error in application and browser console shows no error.
Follow some parts of the code.
The Interceptor
angular.module('digApp').factory('authInterceptor', function(){
return {
request: function(config){
console.log(config);
return config;
}
}
});
A Config do Interceptor
angular.module('digApp').config(function($httpProvider){
$httpProvider.interceptors.push("authInterceptor");
});
for now I’m only displaying what comes from config, but it’s not working, the application locks the requests http that makes the api. And it doesn’t show the console log.(), and neither loads the views of ng-view;
If someone has a good tutorial of Angular login system + jwt + nodejs I am grateful.
What error appears in the log? You can put it here?
– celsomtrindade
So this is the problem in the browser console does not display anything, no error. It does not throw any error exception dai nor know how to debug it.
– Marcos Souza
But then what error does appear? Or why do you think it doesn’t work?
– celsomtrindade
It does not work because the angler does not make the http requests, nor loads the views, if I remove $http.interceptors.push(), it loads the views normally again.
– Marcos Souza