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

you need a second argument to angular directive ????

Bummer! You need a second argument to angular directive. What is this?

app.js
angular.module('foobar')
.directive('customDirective', function() {
  return {
    template: "This is the hello world directive!",
    restrict: "E"
  };
});

1 Answer

Jeff Wilton
Jeff Wilton
16,646 Points

Adding the second parameter is required in order to create a 'new' angular app, as indicated in the challenge. Leaving that second parameter out will just re-use an existing angular app. The teacher mentions this around the 1:18 mark of the previous video, but it is an easy thing to miss. It's one of those tiny and easy to miss details that can cause a lot of headaches!

So, in your first line, make sure to add an empty array as the second param:

angular.module('foobar', [])

I understand it by myself, it's all ok now, Thanks Jeff.