What Is the forRoot Method in Angular 4?

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.