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 Ember.js Models Challenge: ObjectController and ArrayController

Please help me see what I'm doing wrong here!

I have compared this over and over to what he does in the video and I can't see what I'm doing wrong. I keep getting a message that I need to create an Array.controller, which I did. What am I missing??

js/app.js
AnimalShelter = Ember.Application.create();

AnimalShelter.Router.map(function() {
  this.resource('kittens', {path: '/'});
});

var kittens = [
  {id: '1', name: 'Meowzer', cutenessRating: 2},
  {id: '2', name: 'Squeaky', cutenessRating: 3},
  {id: '3', name: 'Fluffy', cutenessRating: 1}
]

AnimalShelter.KittensController = Ember.ArrayController.extend ({
  sortProperties: ['cutenessRating'],
   actions: {
    sortByCutenessRating: function() {
      this.set('sortProperties', ['cutenessRating']);
    }
   }

});
index.html
<!DOCTYPE html>
<html>
<head>
  <title>Animal Shelter</title>
</head>
<body>
  <script src="js/libs/jquery-1.10.2.js"></script>
  <script src="js/libs/handlebars-v1.3.0.js"></script>
  <script src="js/libs/ember-1.8.1.js"></script>
  <script src="js/app.js"></script>

  <script type="text/x-handlebars" id="kittens">
    <h1>Kittens</h1>
  </script>

</body>
</html>

1 Answer

Kristopher Van Sant
PLUS
Kristopher Van Sant
Courses Plus Student 18,830 Points

Hi Janice, try removing the space between .extend and the parenthesis. Like so:

 Ember.ArrayController.extend({

When I pasted your code into the challenge and removed that one space it passed, so hopefully that works for you too!