Angular 2 modules allow apps to be 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?
What is the difference between Javascript Module & Angular Module ? The difference between Js Module & Angular Module is Js module is just a file, but angular module is a class that logically groups the components and others.
Modules are used in Angular JS to put logical boundaries in your application. Hence, instead of coding everything into one application, you can instead build everything into separate modules to separate the functionality of your application.
Modules are the piece or chunk of a JavaScript code written in a file. JavaScript modules help us to modularize the code simply by partitioning the entire code into modules that can be imported from anywhere. Modules make it easy to maintain the code, debug the code, and reuse the piece of code.
Angular makes use of a number of features of ES6 and TypeScript.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With