Angular Js

What is Root and Featured Module?

What is Root and Featured Module?

What is Root Module?

The first module that gets loaded is called Root Module, which is conventionally named as AppModule and is automatically created by the Angular CLI.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }

The AppModule contains just one part, called the AppComponent, and neither pipes nor directives are present. As a result, the declaration array just contains AppComponent.
The other modules that this module is using should be shown in the imports array. It imports the BrowserModule, an Angular library, as a result. Additionally, Routes are needed, therefore we are importing AppRoutingModule.
There are no defined services in the AppModule. The providers array is therefore empty.

Predefined Feature Modules in Angular
Angular comes with many predefined feature modules. These modules expose the components, pipes, or directives that help you build apps faster without implementing every single thing
ReactiveForms Module : This module exports the required directive, like formControlName or formGroup, that helps you create reactive forms.
RouteModule : This module exports the required directive and providers, like routerLink or routerLinkActive, that help you create client-side routing.

Related Post

About Us

Community of IT Professionals

A Complete IT knowledgebase for any kind of Software Language, Development, Programming, Coding, Designing, Networking, Hardware and Digital Marketing.