Here's a question that might come from someone new to programming. I'm trying to avoid hard-coding the values for xsrfHeaderName
and xsrfCookieName
. Can anyone guide me on how to retrieve them from the $httpProvider
?
.factory('XSRFInterceptor', function($cookies) {
return {
request: function(config) {
config.headers[$httpProvider.defaults.xsrfHeaderName] =
$cookies[$httpProvider.defaults.xsrfCookieName];
return config;
}
}
})
.config(function($httpProvider) {
$httpProvider.interceptors.push('XSRFInterceptor');
})
After experimenting with various methods, it seems like there's still more for me to learn about AngularJS. Any help in getting started would be greatly appreciated.