How to set the HTTP Header for a request using AngularJs

To set the HTTP Header for a request using AngularJs you can use the following snippet.

$http({method: 'GET', url: 'www.fesslersoftexample.com/api', headers: {
    'Authorization': 'Basic YmVlcDpib29w'}
});

Use the headers parameter in the config object you pass to $http.

For more informations see the AngularJs API Reference

Please Share us:
Please rate this snippet

11 thoughts on “How to set the HTTP Header for a request using AngularJs

Leave a Reply