Today, I am going to share the difference between the some
powerful angularjs prefix like ng-app vs.
data-ng-app vs. x-ng-app.
This powerful prefix
are used to decide when we need to use data.* , x.* and ng.*.
This is basic concept and use to validate the HTML template
without using the data.* and x.* not possible to validate HTML template.
That means you can say that when we need to validate HTML
Template that time we are using data.* or x.* otherwise we are using simple
ng.*.
One other things on that:
Some time throw error on a property like ng-app but don't throw an error
with data-* or x.* like data-ng-app or x-ng-app.
For the conclusion we can say the only difference regarding
HTML 5 validation and the best practice is used to data-ng-app or x-ng-app not
ng-app.
01
02
03
04
05
06
07
08
09
10
11
12
| //The normalization process of elements or attributes as given below. The prefix x- and data- from the front of the element or attributes. Its convert the( :, -, or _-) delimited name to camelCase. The equivalent examples of elements/attributes that match ngApp. Based on above statement below all are valid directives. 1. ng-app 2. ng:app 3. ng_app 4. data-ng-app 5. x-ng-app |
//The normalization process of elements or attributes as given below. The prefix x- and data- from the front of the element or attributes. Its convert the( :, -, or _-) delimited name to camelCase. The equivalent examples of elements/attributes that match ngApp. Based on above statement below all are valid directives. 1. ng-app 2. ng:app 3. ng_app 4. data-ng-app 5. x-ng-app