adspace


What is the purpose of forroot method in angular 4?

Answer Posted / Sukh Beer Singh

The forRoot() method in Angular 4 (actually Angular 2 and up) is used when you need to create and register a service that should be available throughout the entire application, such as a shared service. The forRoot() method typically returns an instance of the service along with metadata about the module it belongs to, which allows Angular to manage the lifecycle of the service properly.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can primeng be used with angular2?

955


How to get and log an error in angular 4?

885


Angularjs dependency injection of value inside of the module.config?

900


What is the latest angular?

817


What is the latest version of angular?

985


What is a dynamic route in angularjs and how do you implement it?

873


How to use primeng in angular 4?

952


Give the example of angularjs strings?

879


How to enable html5 mode in angular 1.x?

935


How to implement a datagrid table with angular 2 and primeng?

900


How an object or function can get a hold of its dependencies?

858


Which version you are using js?

952


How to create angularjs filter which outputs html?

868