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 trialAshley Sanders
Courses Plus Student 826 Pointsit looks like task 1 is no longer passing ? i am adding code to what was in task 1
What am I missing?
Ashley Sanders
Courses Plus Student 826 Pointsangular.module("foobar", []);
angular.module("foobar")
.directive('customDirective',Function(){
return {
template: "This is the directive"
};
});
5 Answers
Julian Gutierrez
19,201 PointsA 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
19,201 PointsThere 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.
Ashley Sanders
Courses Plus Student 826 PointsThis 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" };
});
Ashley Sanders
Courses Plus Student 826 PointsPerfect that worked. Why was the return a issue? That is what was used in the demos.
Julian Gutierrez
19,201 PointsWhen 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.
Ashley Sanders
Courses Plus Student 826 PointsThanks so much.
Julian Gutierrez
19,201 PointsJulian Gutierrez
19,201 PointsCan you post your code so we can see where you went wrong?