280

Angular.js 使用了几个前缀ng如下的指令:

ng(基本指令)

ng-switch
ng-repeat
ng-view

我想知道是否有人知道ng代表什么,因为我在文档中找不到它。它是某事的首字母缩写词吗?

4

7 回答 7

285

前缀ng代表“Angular;” Angular 附带的所有内置指令都使用该前缀。同样,建议您不要在自己的指令中使用ng前缀,以避免在未来版本的 Angular 中可能发生名称冲突。

常见问题解答

为什么这个项目叫“AngularJS”?为什么命名空间叫“ng”?

因为 HTML 有 Angular 括号,而“ng”听起来像“Angular”。

于 2013-02-03T03:58:23.127 回答
44

我猜你们中间没有多少星际迷航迷。“ng”代表下一代,因为 Angular 是下一代HTML.

“增强”HTML我会说 xD。

于 2014-11-16T19:18:56.030 回答
32

我认为他们采用了 Angular 名称的任意子部分并将其用作名称空间:

正常

加上“NG”听起来不像 Angular;不管你怎么说。

于 2015-04-06T02:52:07.037 回答
9

ng is an abbreviation of Angular.

Programmers don't like to code long names, so they keep it short and that makes it a bit more cryptic. If you look at Assembler, you know what I mean with ADD, JMP etc. JQuery is the name, the $ is what you use. Angular is the name, ng is what you use.

于 2016-11-30T09:19:05.883 回答
5

NG 代表“下一代”。

它在许多应用程序中用作后缀,特别是在Linux中。示例:syslog-ng 和 Aircrack-ng。

于 2015-11-30T23:32:59.323 回答
3

根据AngularJS 杂项常见问题解答

Why is this project called "AngularJS"? Why is the namespace called "ng"?
Because HTML has Angular brackets and "ng" sounds like "Angular".

于 2016-06-21T16:56:07.590 回答
0

This guy is a Google superstar, I think ng is a part of their culture.

https://en.wikipedia.org/wiki/Andrew_Ng

于 2021-04-15T13:04:31.147 回答