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

Joe Hochgreve
PLUS
Joe Hochgreve
Courses Plus Student 2,110 Points

I am able to pass task 1 but it does not seem to like my 'customDirective' no matter how I add it.

Here is how I have done it:

angular.module('foobar', []) .directive('customDirective');

I cant seem to sort out where I am going wrong.

app.js
angular.module('foobar', [])
.directive('customDirective');

2 Answers

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello Joe,

When you make a directive in Angular you must provide two parameters: the name of the directive and the function callback that Angular will invoke when the directive is instantiated by Angular. Try modifying your code as follows.

angular.module('foobar', [])
.directive('customDirective', function() {});

I hope this helps.

Joe Hochgreve
PLUS
Joe Hochgreve
Courses Plus Student 2,110 Points

Ok I see so even if the function is empty the simple requirement is 2 params regardless. Makes sense!