小编And*_*Van的帖子

AngularJS $ http获取数据对象显示状态代码而不是响应

我已经仔细考虑了几天,仍然无法弄清楚我做错了什么,所以任何想法甚至在黑暗中的镜头都会受到赞赏.我试图使用AngularJS $ http get方法向用户显示来自休息服务的响应,但是当我将数据对象打印到控制台时,我始终收到数字200(我相当肯定它给出了我的状态代码).我每次都取得了成功,在发送请求后,Chrome调试工具会向我显示包含所有正确数据的响应.我似乎无法让它出现在变量显示中.如果你想到什么,请告诉我!谢谢!

我的javascript:

$scope.resendDestinations = [];
$scope.resendDestGet = function () {
    var omtTypeCodeString = '';

    for(var i = 0; i < $scope.mySelections.length; i++){
        if(omtTypeCodeString == ''){
            omtTypeCodeString = $scope.mySelections[i].orderHeader.omtOrderTypeCode;
        }
        else{
            omtTypeCodeString = omtTypeCodeString + ',' + $scope.mySelections[i].orderHeader.omtOrderTypeCode;
        }
    }

    $http({
        method: 'GET',
        url: restService.pom + //service url,
        respondType: 'json',
        headers: {
             'Accept': 'application/json',
             'Content-Type': 'application/json',
             'Access-Control-Allow-Credentials': true
        },
        params: {
            orderTypeCode: omtTypeCodeString,
            transactionCode: 3
            }
        }).success(function (status, data, response, header) {
            console.log("Success!");
            //TODO see if this is …
Run Code Online (Sandbox Code Playgroud)

javascript rest get angularjs

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

标签 统计

angularjs ×1

get ×1

javascript ×1

rest ×1