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 trialNick Marsh
14,763 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,763 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,763 PointsStill having trouble with this one. If anyone can point me in the right direction, it would be much appreciated.
Nick Marsh
14,763 PointsThanks! That did it.