Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGavin Murphy
10,004 PointsNot pulling json data
ng-repeat was working correctly until I moved my array to a json file and wrote a service request as shown in the video. Please help.
2 Answers
Gavin Murphy
10,004 Pointsangular.module("todoListApp", [])
.controller("mainCtrl",function($scope, dataService){
dataService.getTodos(function(response){
console.log(response.data);
$scope.todos = response.data;
});
})
.service('dataService', function($http){
this.getTodos = function(callback){
$http.get('mock/todos.json')
.then(callback)
};
});
Gavin Murphy
10,004 PointsHi Andi, thanks for your reply, I messed up this question when I was asking it. The problem was that I couldn't reference the json file while it was static and not on a server, it had to be hosted for the .services directive to work... I appreciate all the help I have got through this. Its a good feeling when people are willing to help you :)
andi mitre
Treehouse Guest Teacher+1 for solving your own question. We're always here to help! :)
Cheers
andi mitre
Treehouse Guest Teacherandi mitre
Treehouse Guest TeacherIs this a specific treehouse challenge? Did you put it in the above directory and what are some of the errors you see in the console if any?
Cheers, Andi
Mars Epaecap
5,110 PointsMars Epaecap
5,110 PointsGavin Murphy i love you. Thanks for this. This treehouse course is letting me down