How do tags created with directives get their names?

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-angularjs/lessons/directives/exercises/directives-directives-ii?action=lesson_resume
<In what way does your code behave incorrectly? Include ALL error messages.>
I don’t understand how the HTML elements get their names. In the exercise Im currently doing the directive is written inside appInfo.js like such:

app.directive(‘appInfo’, function( ){…

And the HTML element created is named “< app-info >”… ¿? How does it get this name?

1 Like

I wondered this too and found out that when the directive uses camelCase, each capital letter represents a dash which is converted behind the scenes.

“The $compile converts from camelCase to dash-separated behind the scenes. So, make sure you use the names correctly otherwise it won’t work.” - https://medium.com/@cironunesdev/angularjs-how-to-name-directives-118ac44b81d4#.u0tt5ot1w

:slight_smile:

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.