Angular ng-repeat vs data-ng-repeat

All we need is an easy explanation of the problem, so here it is.

Is there any difference between ng-repeat or data-ng-repeat in Angularjs?

I believe there are other directives with data prefix as well.


How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

They are aliases. Angular allows both in order to name a directive. The data-ng-repeat allows the HTML to be validated through validators that do not understand Angular.

The documentation is here with directives.

This is from the docs:

Angular normalizes an element’s tag and attribute name to determine
which elements match which directives. We typically refer to
directives by their case-sensitive camelCase normalized name (e.g.
ngModel). However, since HTML is case-insensitive, we refer to
directives in the DOM by lower-case forms, typically using
dash-delimited attributes on DOM elements (e.g. ng-model).

And all these are valid:

  <span ng-bind="name"></span> <br/>
  <span ng:bind="name"></span> <br/>
  <span ng_bind="name"></span> <br/>
  <span data-ng-bind="name"></span> <br/>
  <span x-ng-bind="name"></span> <br/>

AFAIK, you can use these naming conventions in any directive that Angular parses.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply