Skip to main content

Posts

Showing posts with the label custom header http request in angularjs

How to set authorization header on $http request in angularjs with MVC5?

How to set HTTP header for $http.GET request in angularjs? The AngularJs code sample as given below //This is the global var baseURL = "http://localhost:8080/" ; var emailId = window.utility.user.EmailID var userID = window.utility.user.UserID; var userLocationID = window.utility.user.UserLocationID; var authInfo = {     Authorization: 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==' ,     UserID: userID,     UserLocationID: userLocationID }; //END var app = angular.module( 'authApp' , []); //This is the angular services app.service( "myAuthServices" , function ($http) {     this .getUsers = function (url) {         return $http({             method: 'GET' ,             url: baseURL + url,        ...