How does NgModule work in Angular
How does NgModule work in Angular The first time I saw the NgModule decorator and its arguments I was completely lost. I couldn’t understand what was the meaning of imports, declarations, exports, providers or bootstrap and I had a hard time finding clear explanations. So today I will go through each attributes and provide an explanation together with an example to understand what is the role of each NgModule argument. 1. How does a NgModule declaration look like? 2. Imports 3. Exports 4. Declarations 5. Providers The full source code is available on my GitHub https://github.com/Kimserey/ng-samples . 1. How does a NgModule declaration look like? Angular utilises the typescript decorators to define NgModule . It accepts imports , declarations , exports and providers . A typical declaration would look like that: import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { SquareComponent } from './square.component'...