为什么没有angular $ http数据返回错误对象

时间:2014-03-02 20:40:37

标签: ajax angularjs twitter

我正在尝试返回twitter API错误对象in this jsfiddle

这是错误:

{
    errors: [
        {
            message: "Bad Authentication data",
            code: 215
        }
    ]
}

以下是代码:

var myApp = angular.module('myApp', []);

function MyCtrl($scope, $http) {
    $http({
        method: "GET",
        url: "https://api.twitter.com/1.1/statuses/user_timeline.json",
        responseType: "json",
        params: {
            screen_name: "StackCareers"
        }
    }).
    success(function (data, status, headers, config) {
        $scope.data = JSON.stringify(data);
    }).
    error(function (data, status, headers, config) {
        $scope.data = JSON.stringify(data);
    });
}

0 个答案:

没有答案