How to access an array in AngularJS controller populated by $resource get()?
问题 I can not access an array in the AngularJS controller but it works in the view. In the controller: .results returns undefined function TwitterCtrl($scope, $resource){ $scope.twitter = $resource('http://search.twitter.com/:action', {action:'search.json', q:'angularjs', callback:'JSON_CALLBACK'}, {get:{method:'JSONP', params: {rpp: 4}}}); $scope.twitterResult = $scope.twitter.get({q:"example"}); //returns the resource object console.log($scope.twitterResult) //returns undefined console.log(