I was wondering if there is any way to configure all $http requests header with adding custom info. Something like config :
var config = {headers: {
'Authorization': 'Basic d2VudHdvcnRobWFuOkNoYW5nZV9tZQ==',
'Accept': 'application/json;odata=verbose'
}
};
But for all $http calls I will make in different services. I'm sure there is a solution :D.Thanks
You can create a
$http
interceptor to extend your header:A simpler solution could be to use Angular's
run
block:Note: This solution allows you to pass the static value only one time since the
run
block executes only once.