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 Controllers Challenge: Controller Routes and Templates

Ember Action /Route/Controller challenge

i'm sure its a semicolon or something erlse really stupid, but I can't find my mistake, could someone please lend a hand?

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

AnimalShelter.Router.map(function() {
  this.resource('charles-barkley');
});

AnimalShelter.IndexRoute = Ember.Route.extend({
  renderTemplate: function() {
    this.render('charles-barkley');
  }
});

AnimalShelter.CharlesBarkleyController = Ember.Controller.extend({
  actions: {
    // your code goes here
    showInfo: function{
    alert("this is an lert bix");
  }
});
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="charles-barkley">
    <h1>Charles "Bark"ley</h1>
    <p>Click Charles's photo to see more information about him!</p>
    <p><img src='puppies/charles_barkley.jpg' alt='A photo of Charles Barkley' {{action 'showInfo'}}></img></p>
  </script>

</body>
</html>

3 Answers

Nicolas Sandller
Nicolas Sandller
5,643 Points

Look at this part:

AnimalShelter.CharlesBarkleyController = Ember.Controller.extend({
  actions: {
    // your code goes here
    showInfo: function () {  //***HERE the () was missing.***
    alert("this is an lert bix");
  }
});

You are missing a parenthesis after ...function. ItΒ΄s function () {}. Copy that part and try it out.

If you liked my answer please give me an upvote :)!!

nope didn't work, but thanks for pointing that out to me, because that would definitely hinder any attempt when i figure it out later on.

Nicolas Sandller
Nicolas Sandller
5,643 Points

Hey I found another mistake:

AnimalShelter.CharlesBarkleyController = Ember.Controller.extend({
  actions: {
    // your code goes here
    showInfo: function{
    alert("this is an lert bix");
  }
}//This other curly braces was missing. To close the actions:{} object.
});

Let me know is this one was it.