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($scope.twitterResult.results);
}
In the view: .results returns an array of tweets
//This returns an array of tweets
{{$scope.twitterResult.results}}
successcallback in order to use theresultsarray. I wish I could assign the array to a variable and access it outside of that function.$watch('twitterResult', function(newValue) { ... })to detect when it gets asynchronously updated.