I have two Angular modules, A and B.
A has no deps, some configurations and some filters:
angular.module('A', [])
.config(function ($httpProvider) {
// set common headers for $http requests
$httpProvider.defaults.headers.common = {...};
})
.filter('myFilter', function () {
// create a filter
});
B depends on A, so it goes something like:
angular.module('B', ['A'])...
I know that B depending on A means I can use myFilter inside B views.
The question is: does the code in myFilter benefits from the $http common headers I set inside the config() function of the A module (since myFilter belongs to A)?
And when making HTTP requests from inside the B module, are the common headers the ones I set inside A or they are not affected from the configuration inside A?
True to both the questions makes enough sense to me: I config some common headers in the A module that I'll use inside the filters that the A module provides, but I want those same common headers out of my way when I'm inside the B module; still, when I'm inside B views, I want to be able to use A filters with their specific common headers.
Here is what i think. Like any other angular
$httpProvideris also singleton in nature which very well means any changes to it from any where including any module would affect other, or in other words changes are global.