--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en.
Thanks for all your replies!
Perhaps there is a better way to approach my task. I'm trying to add a default transformRequest for the application. to add an Authorization header from my user object which must be included in all server requests. I'm doing this as a default transformRequest so all my $http services can focus on other things. So I am trying to inject the service "app.service" and have it available to my function as parameter name "appUser":
angular.module('SharedServices', ["app.user"])
.config(function ($httpProvider, appUser) { //is it possible to get appUser here?
var handleAuth = function (data, headersGetter) {
var headers = headersGetter();
headers["Authorization"] = appUser.getAuthHeaderValue();return data}
$httpProvider.defaults.transformRequest.push(handleAuth);})