Modules (NgModules)
A module is a single unit of implementation of distinct functionalities. Collections of such modules will be used to implement complex applications. Implementing module patterns helps you avoid global collisions of variables and methods. JavaScript encapsulates both private and public methods under a single object by implementing a modular pattern. The modular pattern achieves encapsulation using closure in JavaScript. JavaScript doesn't support access modifiers; however, the same effect can be achieved using function scopes. All Angular applications are modular in nature. We develop Angular applications by creating many modules. We develop modules to encapsulate functionalities that are independent and have one responsibility. A module exports the classes available in that module. Angular modules are called as NgModules
. At least one Angular module will be present in any Angular application: a root module, which will represented as AppModule
. AppModule
is a class decorated...