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) Controllers and Scope Creating controllers in Angular

Help not sure what I am doing wrong

I am suppose to create a new controller called 'coolCtrl'. What am i doing wrong?

angular.module('foobar', []); .controller('coolCtrl') {

});

6 Answers

angular.module('foobar', []).controller('coolCtrl');

For the sake of first exercise, only the 'coolCtrl' parameter is needed for the controller method, so the answer is actually

angular.module('foobar', []).controller('coolCtrl');

The curly brackets are part of the controller method's second parameter, the anonymous function, which is skipping ahead of the first question.

You have an unneeded semicolon after the module method. Just remove it and it will work

angular.module('foobar', []).controller('coolCtrl') {

});

I tried your answer it didn't work :/

In the second parameter of the "coolCtrl" create an anonymous callback function that takes $scope as a parameter.

Maldon Meehan
Maldon Meehan
4,952 Points

angular.module('foobar', []).controller('coolCtrl', function($scope){});