What is the difference between ng-app and data-ng-app?

Most of these answers are simply saying makes template valid HTML, or HTML Validator Compliant, without explaining what THOSE terms mean, either.

I do not know for sure, but I’m guessing that these terms apply to HTML validation programs that scan your code for standards compliance – kind of like lint. They do not recognize ng-app as a valid attribute. They expect non default HTML attributes to be prefaced with

data-attribute_name_here.

So, the creators of AngularJS have created alternate names for their directives that include the data- in front of them so that HTML validator programs will “like” them.

Leave a Comment