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

Q2 0f 3 angular basic

angular.module('foobar', [])
.controller("coolCtrl", function('$scope'){
 $scope.anonymous = funtion(){
  console.log('');
  };
})

I am kind of stuck on Q-2 to pass $scope. thx

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

1 Answer

Chase Marchione
Chase Marchione
155,055 Points

Hi Ellie,

1) An anonymous function is a function without a name. Thankfully, we don't need to set the property of anything in order to tell the compiler that the function is anonymous.

2) By putting the $scope parameter in quotes, that makes the compiler interpret it as a string literal. Once those quotes are removed, you'll have the parameter you want.

3) console.log is used to print out a message to the screen, but as of the moment we don't have a message to print out.

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

Hope this helps!

thx CJ,