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

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.