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 trial

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

Can't see my todos

I followed along as shown but it seems my todos are not showing. Any idea what's causing that?

Here's my latest code: https://w.trhou.se/ffshlpsfm6

Do you have an error Message? I can not see a syntax error or something like in your Code. Do you launch the application on a webserver?

LIne 13 of your app.js needs to be deleted. The return statement was replaced with the '$scope.todos = reponse.data;

I'm not seeing the todos either. I'm not using Treehouse workspaces. (Could this be the issue?) I am getting the following error in the console: XMLHttpRequest cannot load file:/c:/........mock/todos.json Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

1 Answer

Gustavo Buarque
Gustavo Buarque
7,113 Points

I don't know if you are still having this problem. But if is not working in the workspace it is because in your code, there is a return before the code that you want to execute. dataService.getTodos(function(response){ console.log(response.data); return response.data $scope.todos = response.data; });

When your code get to return the next line will never run.

By the way I have the same problem as Karen has. I'm trying to figure out how to fix this outside a workspace. In my case doesn't show errors.