0

I am a newbie for Angular. I am having the following Angular JS(v.1.7) ui-router

.state('helpPage', {
    url: "/help",
    data: {
        roles: []
    },
    views: {
        helpDoc: {
            templateUrl: 'app/modules/help/help.tpl.html',
            controller: 'helpCtrl'
        }
    }
})

When the User hits this page I want to retrieve the Headers. Can I get them in the Controller or in the ui-route's resolve method itself ?

Tried HttpInterceptor but it is not helping out.

Any help is much appreciated.

georgeawg
  • 48,608
  • 13
  • 72
  • 95

1 Answers1

0

Use the headers property of the $http response object:

$http.head(url).then(function(response) {
     var headerGetter = response.headers;
     console.log(headerGetter("headerName"));
});

For more information, see

georgeawg
  • 48,608
  • 13
  • 72
  • 95