Data not displaying in AngularJS ng-repeat with Twitter API

271 views Asked by At

I've implemented twitter API 1.1 and am calling GET friends/ids. This works fine, and logs to the console without problem. However, I cannot get my data to display in my repeating group. Also, using oauth.io

HTML

 <table>
 <tr ng-repeat="t in friends">
    <td>{{t.users.id}}</td>  
    </tr>
</table>

JS

app.factory('twitterService', function($q) {
  var authorizationResult = false;
  return {
    initialize: function() {

        OAuth.initialize('EXUtPtc6Q0-Yv0lyetS3K5frny8', {cache:true});
        authorizationResult = OAuth.create('twitter');
    },
    isReady: function() {
        return (authorizationResult);
    },
    connectTwitter: function() {
        var deferred = $q.defer();
        OAuth.popup('twitter', {cache:true}, function(error, result) { 
            if (!error) {
                authorizationResult = result;
                deferred.resolve();
            } else {
            }
     });

        return deferred.promise;
    },
    getLatestFriends: function () {
        var deferred = $q.defer();
        var promise = authorizationResult.get('/1.1/friends/list.json').done(function(data)    { 
            deferred.resolve(data);
            console.log(data);
        });

        return deferred.promise;
    }
}
});

 app.controller('TwitterCtrl', function($scope, $q, twitterService) {

$scope.friends;

twitterService.initialize();
$scope.refreshTimeline = function() {
    twitterService.getLatestTweets().then(function(data) {
        $scope.friends = data;
    });
}
});
0

There are 0 answers