Module – Your application is divided into several modules to separate the functionality of your application, and modules are logical boundaries in your application.
In Angular, a module is a location where you may group application-related components, directives, pipes, and services.
The header, footer, left, centre, and right sections all become modules if you are creating a website.
NgModule can be used to define modules. The ngmodule is created in the app when you start a new project using the Angular -cli command. By default, the module.ts file is formatted as follows:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule ({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ],
providers: []
})
export class AppModule { }
There are five crucial choices available for the NgModule decorator.
- Other dependent modules are imported using the imports option. Any web-based Angular application must by default include the BrowserModule.
- In the relevant module, components are defined using the declarations option.
- The bootstrap option instructs Angular which component in the application to bootstrap.
- The injector of this module has a set of injectable objects that may be configured using the providers option.
- A group of components are dynamically loaded into the view using the entryComponents option.
I hope you will like the content and it will help you to learn What is an Angular Module ?
If you like this content, do share.