Introduction
For better understanding, before directly jumping into the Angular module, let me provide a few lines about what is Angular and what are Angular application.
Angular
- Angular is a framework to develop rich client-side applications for the web.
- It is an open source JavaScript framework designed by Google.
- Google changed the name from Angular.js to Angular because the structure of the application varies entirely.
- Applications developed using Angular framework are referred to as Angular applications.
Angular Application
- An Angular application is a collection of modules.
- The execution of an Angular application starts from the module specified in the main.ts file.
- .ts files are written in TypeScript language.
Example
- import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
- import { AppModule } from './app/app.module';
- platformBrowserDynamic().bootstrapModule(AppModule);
Angular Module
- In general, Module is a collection of business/domain functions designed to achieve a single purpose. All the functions within module must work together cohesively to achieve the objective which is defined for the module.
- In Angular, a module is defined in the TypeScript file which is having the decorator @NgModule.
- NgModule is a function that takes a single metadata object, whose properties such as declarations, export, import, bootstrap, and providers, describe the module.
Example
Pictorial representation of NgModule decoration -

In the above diagram, @NgModule directive takes a single metadata object whose properties describe the module.
- declarations - the View classes that belong to this module. Mainly, Angular has three kinds of View classes: components, directives, and pipes.
- imports- other modules whose exported classes are needed by component templates declared in this.
- bootstrap- the main application View called the root component, that hosts all the other app Views. Only the root module should set this bootstrap property.
Code Representation of NgModule Decoration


Khaja MoizuddinPosted Nov 23, 2019, 5:11 AM
This article is very informative Karthik, keep up the good work.
Karthik ElumalaiPosted Sep 30, 2017, 1:57 AM
Thanks a lot Hamid Khan for positive feedback
Hamid KhanPosted Sep 29, 2017, 9:38 AM
Nice.............................................