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.

JavaScript AngularJS Basics (1.x) Services in Angular Using Services To Get Data

Alessandro Muraro
Alessandro Muraro
15,457 Points

All 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){

        $scope.todos = response;

  .service('dataService', function($http) {
    this.getTodos = function(callback){

My todo list shows five empty rows.

Any help is appreciated, thanks!

2 Answers


Try adding .data to the response your assigning to $scope.todos

        $scope.todos = response.data;

That should probably fix it.