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.

Nick Marsh
14,255 PointsAngular Stage 4 Challenge 2
I can't seem to get this one right. Any help would be much appreciated.
angular.module('myApp', [])
.directive('treehouseCourse', function () {
return {
link: function ($scope, $element, $attrs) {
$element.treehouseCourse({
console.log($attrs.course-title);
});
}
}
});
6 Answers

davidschreiter
15,005 PointsHey bro,
The '$element.treehouseCourse({' and '});' part is unnecessary.
Also remember the difference in naming conventions between HTML and javascript. i.e. 'course-title' in HTML is referred to as 'courseTitle' in javascript.
Keep on keepin' on, bro.

Kerry Rosado
14,368 PointsSo basically the answer should be:
console.log($attrs.courseTitle);

Salman Akram
Courses Plus Student 40,065 PointsHi Nick,
What's the question please?

Nick Marsh
14,255 PointsHi Salman,
The question is
Look at the <div> element with the treehouse-course directive in index.html. Then update the directive in app.js to call console.log with the value of the course-title attribute.

Nick Marsh
14,255 PointsStill having trouble with this one. If anyone can point me in the right direction, it would be much appreciated.

Nick Marsh
14,255 PointsThanks! That did it.