Skip to main content

Posts

Showing posts with the label What Is the forRoot Method in Angular 4?

What Is the forRoot Method in Angular 4?

What Is the forRoot Method? The forRoot is a static method and it’s very easy for developers to configure the modules and the best example is - RouterModule.forRoot . The RouterModule also offers a forChild . It’s also a static method and use to configure the routes of lazy-loaded modules. The forRoot and forChild are the traditional names for methods that configure services in root. Stayed Informed – Angular4 Documentations with Example Example – import { NgModule } from '@angular/core' ; import { RouterModule, Routes } from '@angular/router' ; import { HttpModule } from '@angular/http' ; import { FormsModule, ReactiveFormsModule } from '@angular/forms' ; import { AppComponent } from './components/app/app.component' import { NavMenuComponent } from './components/navmenu/navmenu.component' ; import { HomeComponent } from './components/home/home.component' ; import { UserComponent } from './compone...