What is the difference between Factory, Service and Provider?



What is the difference between Factory, Service and Provider?..

Answer / chaitanya

Factory - A factory is a simple function which allows you to add some logic before creating the object. It returns the created object.

Service - A service is a constructor function which creates the object using new keyword. You can add properties and functions to a service object by using this keyword. Unlike factory, it doesn’t return anything.

Provider - A provider is used to create a configurable service object. It returns value by using $get() function.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What are the types of linking function?

0 Answers  


What is the use of systems? How is webpack better to use in angular?

0 Answers  


What is the use of @Input and @Output?

0 Answers  


Explain routeprovider in angularjs?

0 Answers  


What is autofilter in excel?

0 Answers  






What is ngmodule decorator?

0 Answers  


What is components in angular?

0 Answers  


What is rx observable?

0 Answers  


Difference between var, let, const?

0 Answers  


how to generate a module in angular?

0 Answers  


What is the use of @viewchild?

0 Answers  


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

0 Answers  


Categories