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 trialDaniel Hildreth
16,170 PointsNeed Help With AngularJS Directives
I need help with one of the challenges in the AngularJS Basics course. It asks me to "In Javascript, how would you name a directive that could be attached as βmy-custom-directiveβ?" How do I name this, and why do I name it that way? I've watched the videos a few times over and it keeps stumping me.
3 Answers
MIke Allen
9,727 PointsHey Daniel,
Wish I could claim responsibility for this answer but if you check https://teamtreehouse.com/forum/angular-js-quiz-question you will find the answer you need. But basically its because elements in HTML that have dashes, i.e βmy-custom-directive' become camelCased in JS, i.e 'myCustomDirective'
So I guess you would just call your directive like so
.directive('myCustomDirective', function() {
}
Hope that helps!
Daniel Hildreth
16,170 PointsHey thanks for your help! I can't believe it was that simple LOL! AngularJS is racking my brain!
MIke Allen
9,727 PointsNo worries Daniel, glad I could help :-)
Craig Watson
27,930 PointsCraig Watson
27,930 PointsHi Daniel,
I have received and answer request for this question however unfortunately I have no knowledge of Angular JS as I have not yet done the course.
I have asked another Treehouse Member who I feel may be able to help base don what I have seen in thr forum previously and hope they can help you get to the bottom of your question :)
Craig