在尝试访问安全的 Api 时,我需要在我的 Angular http 请求中发送 header 数据
JavaScript 代码:
$http.post('http://localhost/api/validate', user).success(function () {
$scope.reset();
$scope.activePath = $location.path('/');
如何在此请求中发送 header 数据?
最佳答案
//store the header data in a variable
var headers = { 'Authorization': authToken };
//Add headers with in your request
$http.post('http://localhost/api/validate',user, { headers: headers } ).success(function()
关于javascript - 如何在 Angular js 中的 http 请求中发送 header 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20326514/