AngularJS $ http请求隐藏授权标头

时间:2016-07-25 10:11:10

标签: javascript angularjs authorization http-get

我的AngularJS函数,我使用标题列表生成$ http GET请求。 其中一个是秘密的:授权。如何将其隐藏起来?

$scope.SearchCar = function () {
var config = {
    headers: {
        'Authorization': 'Basic code.to.hide',
        'Host': 'some.host.com'
    }
}
var url = 'https://some.host.com/car?q=' + $scope.carName;

$http.get(url, config)
    .then(function (response) {
        //success
    },
    function (response) {
        //failure
    }).finally(function () {
        //finally
    });
}

0 个答案:

没有答案
相关问题