Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Alessandro Muraro
15,457 PointsAll my todos are gone
I'm trying to follow along, and it seems to me all has been followed correctly, but clearly I must be missing something.
Right now, I see no todo items, although the ng-repeat is working
My code is as follows:
angular.module("todoListApp", [])
.controller('mainController', function($scope, dataService){
dataService.getTodos(function(response){
console.log(response.data);
$scope.todos = response;
});
})
.service('dataService', function($http) {
this.getTodos = function(callback){
$http.get('js/mock/todos.json')
.then(callback)
}
})
;
My todo list shows five empty rows.
Any help is appreciated, thanks!
2 Answers

rvandaalen
24,090 PointsHI
Try adding .data to the response your assigning to $scope.todos
dataService.getTodos(function(response){
console.log(response.data);
$scope.todos = response.data;
});
That should probably fix it.

Alessandro Muraro
15,457 PointsThanks, that did the trick!