AngularJS - NG-网格和数据-NG-电网之间的差异 [英] AngularJS - Difference between ng-grid and data-ng-grid
问题描述
我创建使用可用于VS2012 AngularJS模板的ASP.NET MVC 4项目。在一个网页,网格是HTML codeD像
I created a ASP.NET MVC 4 project using AngularJS template available for VS2012. In one of the pages, the grid is coded in html like
<div class="grid-style" data-ng-grid="userGrid">
</div>
不过,虽然与电网寻找一个问题,我看到人们使用像
But while searching for a problem with the grid, I see people use like
<div class="grid-style" ng-grid="userGrid">
</div>
什么是数据-NG-格
和 NG-格
?
推荐答案
虽然有已经回答了这个问题标记为正确,但值得注意的是,这不是关于浏览器的支持 - 它是数据
属性在XHTML和HTML规范实际上规定,因此是有效的标记。这是很好的做法是使用数据纳克 - *
,但这不是由于浏览器的合规性;这是进行验证。 (在HTML的情况下,有效的标记是preferred在XHTML的情况下,有效的标记是非常重要或页面将终止。)
Although there's already an answer marked correct for this question, it's worth noting that it's not about browser support - it's that data
attributes are actually defined in the XHTML and HTML specs and as such are valid markup. It's good practice to use data-ng-*
, but this isn't due to browser compliance; it's for validation. (In the case of HTML, valid markup is preferred. In the case of XHTML, valid markup is vital or the page will break.)
.NET HTML标记将使用数据-NG
属性。再次,这是对HTML重要得多XHTML的,但仍然很重要。
.NET HTML markup will use data-ng
attribute so that it produces HTML markup that will pass validation rules. Again, this is much more important for XHTML, but still important for HTML.
这篇关于AngularJS - NG-网格和数据-NG-电网之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!