Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript AngularJS Basics (1.x) Controllers and Scope Creating controllers in Angular

I'm pretty sure i"m reading this completely wrong, but i'm confused as to what it is asking

some guidance would be awesome. I"m trying to add scope to a variable called someNumber with a value between one and five. Is this a range where I have to do math.random(), or is it me picking one number or am i completely off track?

app.js
angular.module('foobar', [])
.controller("coolCtrl",function($scope){
  var someNumber = $scope.value(4);
});

2 Answers

Jesse Zelaya
Jesse Zelaya
13,539 Points

This is what you're looking for

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

Why did you remove the final semicolon?

thank you so much! i knew i was making it harder than it had to be.

Jesse Zelaya
Jesse Zelaya
13,539 Points

Deanna O'Neal, it shouldn't be an issue for this challenge, but it is good practice to use semi-colons to prevent errors. Didn't notice I removed it. Thanks for catching that!