ChatGPT解决这个技术问题 Extra ChatGPT

What does the ng stand for in Angular.js directives

Angular.js uses several directives prefixed with ng like below:

ng (base directive)

ng-switch
ng-repeat
ng-view

I was wondering if anyone knew what ng stood for because I couldn't find it in the docs. Is it an acronym for something?

I say forget it even exists and use the standards compliant data-prefix instead.
@ACJ Hmm... I thought that ng was the default prefix in AngularJS. What should be used instead, according to your experience?
@KonradViltersten, the ng- prefix is the default. However, the data- prefix is a more standards-compliant way to achieve the same result. If you’re concerned with mixing up Angular related stuff with plain old HTML, you can of course also use a data-ng- prefix. That’s perfectly valid.
Does it have any connection with Andrew Ng?
Long before the framework was introduced, I heard of NG from watching a lot of Hong Kong flix on DVD; they often contained a bunch of "N.G. Scenes" or "No-Good scenes": Deleted scenes. I even saw a movie where a character shouted "N.G.! N.G.!" in the context of "This doesn't count!" Now whenever I work on an Angular project I usually read the ng-codes as "no-good-whatever" or sometimes, if NG is followed by a vowel, as if it were a Cantonese word, like "ngo."

C
Community

The prefix ng stands for "Angular;" all of the built-in directives that ship with Angular use that prefix. Similarly, it is recommended that you do not use the ng prefix on your own directives in order to avoid possible name collisions in future versions of Angular.

From the FAQ:

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


"ng" definitely does not sound like "Angular".
"ng" sounds like "Angular" the same way "mkdir" sounds like "make directory". As in old Hebrew, vowels are irrelevant. :-)
@Charles Roth "ng" does not sound like "Angular" in this context because I want to believe that when you pronounce "mkdir", you'll usually go like "make directory" as you rightly put it; but I bet when you want to pronounce something like "ng-view", common folks will usually go like "EN-GEE-VIEW"... That doesn't sound like "Angular" to me -\_0_/-
Y'all are thinking about this way too much :P
Now it makes much more sense to me, why the framework is called Angular and what ng stands for. It has no usefulness, but still a fun fact to learn)
8
8bitjunkie

I guess there are not many Star Trek fans among you. "ng" stands for Next Generation, as Angular is the next generation of HTML.

"Enhanced" HTML I would say xD.


It doesn't stand for Newgrounds?
I really want this to be true.
M
Moe

I thought they took an arbitrary subsection of the Angular name and used it as the name space:

aNGular

Plus "NG" does not sound like Angular; no matter which way you say it.


It is not that NG sounds like Angular. Of course, NG sounds like ngee. But we don't have to compare the pronunciations of NG with the full word Angular. NG is more of an abbreviation. So even if we drop the first A and try to pronounce Ngular it'll still sound like Angular only. So they took the starting fragment NG of the word Ngular to create an abbreviation which is used a prefix.
n
nbro

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.


N
NaN

NG stands for "Next Generation".

It is used in many applications as a suffix, specially in Linux. Example: syslog-ng and Aircrack-ng.


Doesn't the ng in the case of aircrack stand for "engine"?
Do you have documentation to support that this is relevant to Angular? Otherwise, I'm not sure this addresses the OP.
Angular 1 was not next generation. It was Just crap by design.
r
ruffin

According to the AngularJS Miscellaneous FAQ:

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


From Moe's post below, I agree ""NG" does not sound like Angular; no matter which way you say it.". This is from their own FAQ. =)
I find it hilarious that they think "ng" sounds like "angular". Angular has 3 syllables for goodness sake.
C
Chris Nelson

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

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


There are no super stars working at Google. Just very very very Lucky Guys.