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

ryan coughlan
ryan coughlan
13,506 Points

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