0

All is in the question :

I understood I have to declare the string with two custom letters than the uppercase word giving sense to the directive for example

djLoad 

in the directive declaration which becomes

dj-load 

in the view.

How about declaring

 dataDjLoad

which would become

data-dj-load

in the view ?

Mantisse
  • 309
  • 4
  • 15

1 Answers1

3

The data prefix is stripped in the directive and attribute names by angular, so you should not use it. See "Normalization" section in the documentation.

The idea however is correct, directive declared as myDirectiveName (camelCase) should be used as my-directive-name or my:directive:name or my_directive_name in html.

If you still want to use the data prefix in your directive's name (e.g. dataDjLoad) - you should use it this way: <div data-data-dj-load></div>.

Here the EXAMPLE.

Alexander Kravets
  • 4,245
  • 1
  • 16
  • 15