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) Services in Angular Create an Angular service.

Create a new service called 'myService'.

Here's my solution that didn't pass:

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

.service('myService', function(){

});

3 Answers

Deanna,

put that semicolon back, then remove the semi-colon on the first line. That's the one that ends the line, preventing service from chaining to the end of module.

Nicolas

Wow. Feeling a little less than brilliant right now. Thank you so very deeply much!

angular.module('foobar', [])

.service('myService', function() { });

Deanna,

In order to chain the service method onto the module, you have to remove the semi-colon. Then your code should work fine. Happy coding!

Nicolas

I got this message again after removing the semicolon: Bummer! There was an error with your code: SyntaxError: Parse error

angular.module('foobar', []);
.service('myService', function(){

})