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) Getting Started with Angular Your First Angular Directive

Soundar Rajan
PLUS
Soundar Rajan
Courses Plus Student 47 Points

Directive is not working in hello-world.js

I checked using developer tool also

I don't know if in particular, this is your case, but I found out that the script file was incorrectly displaying that it existed in the script folder I would recommend right clicking in folder root folder structure and hitting refresh.

I came to this conclusion that the script was not loading because there was error in the browser console saying 404 which means missing files/dependencies

after a look up to the sources in the chrome tab, I noticed the hello-world.js file was missing! which meant the dependency didn't save.

If you need any further help or resolution to why maybe your code is not running feel free to message me :)

Hope this helps!~

Here's the code i have in hello-world.js

angular.module("todoListApp")
.directive('helloWorld', function() {
  return {
    template: "This is the hello world directive!" 
  };
});
Joel Kraft
Joel Kraft
Treehouse Guest Teacher

Soundar Rajan,

The hello-world app is working for me. Try deleting your workspace entirely, then reloading it from the video page. If that doesn't work, post the code you're using so we might see where the problem is.

1 Answer

I was having the same issue. In your index.html file add your script tags to the head, instead of the body. That worked for me