I am using AngularJS and NGResource and I can't figure out why when I use query, I keep getting an empty array back.
In my controller, I am doing
Task = $resource('/tasks');
var tasks = Task.query(function () {});
console.log(tasks);
$scope.tasks = tasks;
In the view
{{tasks}}
In the view it displays correctly
[{"created_at":"08/08/2013","created_by_id":2,"description":"description","id":1,"name":"test task 1","parent_task_id":null,"task_type_id":1,"updated_at":"08/08/2013"},
{"created_at":"08/08/2013","created_by_id":2,"description":"description","id":2,"name":"test task 2","task_type_id":1,"updated_at":"08/08/2013"}]
but in the console it gets logged as an empty array:
[]
Also, i'm using batarang extension for chrome and the scope that it shows tasks as having is:
tests:
[ ]
I need to perform some data operations on the returned value before I put it into the $scope model. Is this typical behavior and theres something i'm missing? Or am I doing something wrong? Any ideas would be appreciative. I've been stuck on this for too long.