角NG重复数据VS-NG重复 [英] Angular ng-repeat vs data-ng-repeat
问题描述
有间 NG-重复
或数据-NG-重复
在Angularjs?
Is there any difference between ng-repeat
or data-ng-repeat
in Angularjs?
我相信还有其他指令与数据
preFIX为好。
I believe there are other directives with data
prefix as well.
感谢
推荐答案
他们是别名。角同时允许以命名指令。在数据-NG-重复
允许HTML通过表示不理解角度验证器进行验证。
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.
该文档是这里指令的。
这是从文档:
角正常化元素的标签和属性的名称确定
哪些元素匹配该指令。我们通常是指
其区分大小写的驼峰规范化名称指令(例如
ngModel)。然而,由于HTML不区分大小写,大家参考
在由小写形式DOM的指令,通常使用
在DOM元素划线分隔的属性(例如NG-模型)。
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/>
据我所知,您可以使用这些命名约定的任何的指令,角解析。
这篇关于角NG重复数据VS-NG重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!