What is Angular 2 module?
"Simply it's like a box which encapsulates angular components"
import { NgModule } from '@angular/core';
@NgModule({})
Class which decorated with NgModule
Arrange code in modular way
Extend our application with external modules
Some useful tips as below;
Tip #1
Every application must bootstrap one component, which known as "root application component".
[code language="javascript"]
bootstrap: [
AppComponent
]
[/code]
Tip #2
Every components, directives and pipes must only belong to only one Angular module.
Because we follow singleton design pattern.
Tip #3
Only declare components, directives and pipes under declarations array.
[code language="javascript"]
declarations: [
AppComponent
, AppFilterPipe
, AppDirective
]
[/code]
Tip #4
Never re-declare modules belongs to another module, because if we do so we polluting core objective of Angular modules.
Tip #5
All declared components are private by default and only accessible to current modul…