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 Review: Getting Started with Angular

it looks like task 1 is no longer passing ? i am adding code to what was in task 1

What am I missing?

Julian Gutierrez
Julian Gutierrez
19,201 Points

Can you post your code so we can see where you went wrong?

angular.module("foobar", []);

angular.module("foobar")
.directive('customDirective',Function(){
           return {
           template: "This is the directive"
           };

           });

5 Answers

Julian Gutierrez
Julian Gutierrez
19,201 Points

A couple of things: There is no need for a semi-colon before the directive method. In the function try using console.log instead of return.

angular.module('foobar',[])
.directive('customDirective',function(){
  console.log("This is a custom directive!");
});
Julian Gutierrez
Julian Gutierrez
19,201 Points

There is no need to start another app just keep adding to the code from the first challenge. The challenge also needs you to log out "This is the directive" you can use console.log inside of the function for that.

This is what i get if i remove the second app. (parsing error. ) I thought i had to use the second to add to the app.

angular.module("foobar", []); .directive('customDirective',Function(){ return { template: "This is the helloworld directive" };

       });

Perfect that worked. Why was the return a issue? That is what was used in the demos.

Julian Gutierrez
Julian Gutierrez
19,201 Points

When doing this challenge I too attempted to return a template as shown in the video. The function in the directive can be programmed to do just about anything, this challenge just happened to ask for a simple log of the phrase; that's my guess at least.

Thanks so much.