Using $http.defaults.headers.common for global headers
In AngularJS, $http.defaults.headers.common is a way to define global HTTP headers for all HTTP requests made using the $http service. This can be useful for setting authentication tokens, content types,….