Angular modules Flashcards
What is an Angular Module
Class with @NgModule decorator.
It
- Organizes the pieces of our application
- Arranges them into blocks
- Extend our application with capabilities from external libraries
- Provide a template resolution environment
- Arrange and re-export
Ng module can be loaded in 2 ways?
Eagerly and Lazy.
Every component, directive or pipe belong to
an angular module
Every application has
At least one angular module and at least one app component
Bootstrap Array
Defines the component that is the starting point of the application and the component that is loaded when app is started
Bootstrap array must
bootstrap at least one component, the root app component
Bootstrap array should
only be used in the root app module, AppModule
Every component, directive and pipe we create is declared by the
Declarations array
Every component, directive and pipe we create must belong to
one and only one angular module
Declarations array only
declare component, directives and pipes
All declared components, directives and pipes are private by default. They are only accessible to other components, directives and pipes declared in the
same module
The template resolution environment is provided by
its own module
Exports array allows us to
share components, directives and pipes with another modules
3rd party modules and system angular modules and our own modules can be
re-exported
If other components need to we can export with exports array
any component, directive or pipe