NikxDa
NikxDa

Reputation: 4187

Why does Angular 2 name a module NgModule and not just Module

So in Angular 2, a lot of things improved compared to Angular1 (AngularJS). I'm really happy with it. But what confuses me the most is the in my opinion inconsistent naming:

Component: @Component
Module: @NgModule

Why would the module be prefixed with Ng, when the component is not? Is there any reason for this inconsistent naming?

Upvotes: 2

Views: 166

Answers (2)

JoCa
JoCa

Reputation: 1135

Starting with ECMAScript 2015, JavaScript has a concept of modules. TypeScript shares this concept.

Modules (TypeScript)

Modules are an already existing concept in TypeScript and ECMAScript. They probably didn't want to introduce a double meaning for "Module".

Upvotes: 1

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657128

Module is quite overloaded (ES6 modules) for example. There is a lot of confusion about TypeScript imports and @NgModule({imports: [...]}) for example.

They just wanted to make it clear what this module concept is about. Component is much more unlikely to be confused when Angular is used.

Upvotes: 3

Related Questions