How do tags created with directives get their names?


#1



https://www.codecademy.com/courses/learn-angularjs/lessons/directives/exercises/directives-directives-ii?action=lesson_resume

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?


#2

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

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