小编Wes*_*Wes的帖子

AngularJS如何在Http请求中包含头

我是angularjs的新手.我正在尝试发出需要授权的API请求.我已将它包含在请求的标题中,但它仍然无法正常工作.我确信我的访问令牌正在运行.有什么建议?

$scope.fetch = function() {
    $scope.code = null;
    $scope.response = null;
    $http({
        method: $scope.method,
        url: $scope.url,
        cache: $templateCache,
        headers: {
            Authorization: "access token"
        }
    }).
    success(function(data, status) {
        $scope.status = status;
        $scope.data = data;
    }).
    error(function(data, status) {
        $scope.data = data || "Request failed";
        $scope.status = status;
    });
};
Run Code Online (Sandbox Code Playgroud)

angularjs

5
推荐指数
1
解决办法
9290
查看次数

AngularJS使用双向数据绑定将img元素标签中的图像显示为源?

我正在发出一个http请求,它返回一个图像的URL.我想在我的html页面中显示图像.有没有办法做到这一点?我想要做的是(这不起作用但是......)img src = {{result.imageurl}}

html javascript data-binding two-way angularjs

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

angularjs ×2

data-binding ×1

html ×1

javascript ×1

two-way ×1