We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Thursday, January 3, 2019

Module in Angular 7

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.
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 which
component 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 moduleName
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
or default module in import section


No comments: