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.

Andrew Alvarez
11,964 PointsChallenge Task 1 of 1
Challenge Task 1 of 1
In index.html, we've set up a template with a photo. In the CharlesBarkleyController, create an action that shows an alert box when the photo is clicked.
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 ('charles-barkley"');
}
}
});
<!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
5,643 Pointscreate an action that shows an alert box when the photo is clicked:
Try out this code, you are missing a ":" after the action showing. Also remove the second " in the alert function.
AnimalShelter.CharlesBarkleyController = Ember.Controller.extend({
actions: {
// your code goes here
showinfo : function () {
alert ('charles-barkley');
}
}
});

Nicolas Sandller
5,643 Pointscould you give my reply an uproot if it helped?

erika harvey
Courses Plus Student 14,540 Pointsthis is how i got it to work
AnimalShelter.CharlesBarkleyController = Ember.Controller.extend({
actions: {
showInfo: function() {
alert("the pic has been clicked");
}
}
});