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 Services and Dependencies Services: Factory

You never taught the viewers how to declare an object, this prevents us from actually completing the question.

First time trying to create an object.

angular.module('treehouseCourse', [])
.factory('Course', function() {
  var object = [
      "title" : "Intro to Angular"

  return object;

<!DOCTYPE html>
<html ng-app="treehouseCourse">
    <script src="js/angular.js"></script>
    <script src="app.js"></script>
  <body ng-controller="MyCourseCtrl">

3 Answers

Benedict, the course you're referring to is classified as an "Advanced" course, with other courses listed for content you should learn first. This is not the sort of course that will walk you through how to declare an object. If you don't already know how to do that, and many other Javascript basics, take a few less advanced JavaScript courses first and build up to this one.

I agree with Daniel. Declaring an object is covered in earlier courses. I would advise starting at the beginning and working your way up. There should be a track specifically designed for learning JS from the ground up.

On another note, unless you are declaring an array, you probably shouldn't be using square brackets in your JS code.

Good luck.

Andy Simmons
Andy Simmons
Courses Plus Student 3,734 Points

As mentioned already, I wouldn't expect this course to teach how to create an object. Also, your var object is actually an array that's holding a set of objects.