Module is a container or logical group of components and services.In every application, it should have at least one module or default module,We can call this module is app module in our application.We can also create multiple module according to our requirement
When create our angular application that time automatically creates a default module.And also creates some code like below.
2. imports
In imports, When create the module then we declare is module in Imports.
3. providers
component load first.
ex. like, ng g module myModule
After that press enter.
Note: When we create any module then we have import that in root module or
When create our angular application that time automatically creates a default module.And also creates some code like below.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
We can see in above code, It has created some arrays and in that array maney
terms in @NgModule.
Note: @ means it is sambole of decorator in Angular.
1. declarations
In declarations, We declare component, Pipe and directive.2. imports
In imports, When create the module then we declare is module in Imports.
3. providers
In Provider, We declare service
4. bootstrap
In bootstrap, this is use for booting process in our application that whichcomponent load first.
Now, How to create Module.
when we want to create module then open terminal we have to use below
command
ng g module moduleNameex. like, ng g module myModule
After that press enter.
or default module in import section
No comments:
Post a Comment