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

barry abrams
barry abrams
465 Points

Challenge: How to log string in body of callback function Error:need to call 'angular.module' method within app.js

Angular Basics: C-Task 3 of 3

I need to console.log a string in the body of the callback function.

How do I call the angular.module method?

The first 2 steps have been checked and are correct.

Other Treehouse Users have had this problem and I tried the solutions they provided but they didn't work for me.

Any help would be appreciated.

app.js
/* Step 1 in process is to create a module via
app.js file */
angular.module("foobar", [])
/* Step 2: Attach a Custom Directive called "customDirective" to the Module
called "foobar" */
.directive("customDirective", function() {

    console.log("This is a custom directive!");
});

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

Your code looks like it should pass and it will if you strip the comments out. I guess the challenge checker doesn't like them for some reason.

Mohammed Abdalla
Mohammed Abdalla
7,448 Points

just remove the semicolon at the end of statement "console.log("This is a custom directive!");"