ajgisme
ajgisme

Reputation: 1765

Get response headers of post request in angular

I'm trying to make a simple post request in Angular and acquire the response the headers. The problem is I get this response for the header:

function (d){b||(b=fd(a));return d?(d=b[G(d)],void 0===d&&(d=null),d):b}

Angular code:

$http.get(url).success(function(data, status, headers, config) {
    callback(data, status, headers, config);
});

What am I missing?

Upvotes: 0

Views: 737

Answers (2)

ervin
ervin

Reputation: 1

AngularJs v1.7.5

 $http({
      ...
      }).then(function success(data) {
            var heder=data.headers();
         }

Upvotes: 0

ajgisme
ajgisme

Reputation: 1765

My colleague found the answer: the response was a function so should therefore be run as a function. So to get the value of the headers I used this:

$scope.results = headers();

Upvotes: 1

Related Questions