Angular 2 modules allows app to divided into multiple modules each serving a different purpose. But isn't that what ES6 modules also supposed to do?
What is the difference between the two?
Angular 2 modules allows app to divided into multiple modules each serving a different purpose. But isn't that what ES6 modules also supposed to do?
What is the difference between the two?
Taken from angular.io:
The Angular module classes differ from JavaScript module class in three key respects:
An Angular module bounds declarable classes only. Declarables are the only classes that matter to the Angular.
Instead of defining all member classes in one giant file (as in a JavaScript module), we list the module's classes in the
@NgModule.declarations
list.ES modules vs Angular modules:
ES modules are code files that import or export something while angular modules organize the application into cohesive blocks of functionality.
ES modules organize our code while angular modules organize our application.
ES modules modularize our code while angular modules modularize our application.
ES modules promote code reuse while angular modules promote application boundaries.
Taken from this source: Angular Modules vs ES6 Modules