Angularjs,使用数据-NG-控制器和NG-控制器 [英] Angularjs, using data-ng-controller and ng-controller

查看:155
本文介绍了Angularjs,使用数据-NG-控制器和NG-控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我看到数据-NG-控制器但更多的是 NG-控制器

Sometime I see data-ng-controller but more often ng-controller

NG-控制器我已经用这似乎很清楚。但数据-NG-控制器 ..是什么呢?

The ng-controller I already have used and this seems clear. But data-ng-controller.. what is for?

什么是它们之间的区别,并在使用什么?

What are the differences between them, and where to use what?

推荐答案

Angularjs使用的指令名归一化处理/属性匹配。

Angularjs uses a normalization process for directive name / attributes matching.

这在angularjs实况 http://docs.angularjs.org/guide/directive

From the angularjs docu at http://docs.angularjs.org/guide/directive.

匹配部分的指令:

归一化处理是如下:

地带x和从元件的正面数据 - /属性。
  转换: - ,或者_分隔的名字驼峰

Strip x- and data- from the front of the element/attributes. Convert the :, -, or _-delimited name to camelCase.

这篇关于Angularjs,使用数据-NG-控制器和NG-控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆