Skip to main content
added 343 characters in body
Source Link

You can always tell angular to add the header using the $httpProvider like this:

myApp.config(['$httpProvider','$rootScope', function ($httpProvider, $rootScope) {
    $httpProvider.defaults.headers.common['Authorization'] = 'Basic' + $rootScope.apiKey;
}]);

This will add the header to ALL requests. For get and post, you can set the : $httpProvider.defaults.headers.get['Authorization'] = ''; and $httpProvider.defaults.headers.post['Authorization'] = ''; instead of $httpProvider.defaults.headers.common['Authorization'] if you don't want the header to be added to all requests.

You can always tell angular to add the header using the $httpProvider like this:

myApp.config(['$httpProvider','$rootScope', function ($httpProvider, $rootScope) {
    $httpProvider.defaults.headers.common['Authorization'] = 'Basic' + $rootScope.apiKey;
}]);

You can always tell angular to add the header using the $httpProvider like this:

myApp.config(['$httpProvider','$rootScope', function ($httpProvider, $rootScope) {
    $httpProvider.defaults.headers.common['Authorization'] = 'Basic' + $rootScope.apiKey;
}]);

This will add the header to ALL requests. For get and post, you can set the : $httpProvider.defaults.headers.get['Authorization'] = ''; and $httpProvider.defaults.headers.post['Authorization'] = ''; instead of $httpProvider.defaults.headers.common['Authorization'] if you don't want the header to be added to all requests.

Source Link

You can always tell angular to add the header using the $httpProvider like this:

myApp.config(['$httpProvider','$rootScope', function ($httpProvider, $rootScope) {
    $httpProvider.defaults.headers.common['Authorization'] = 'Basic' + $rootScope.apiKey;
}]);