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

Difference between sessionstorage, cookies, and localstorage.

0 Answers  


What is the difference between service and factory?

0 Answers  


Why does angular need an entrycomponents?

0 Answers  


What is aot compilation? Why use in angular 2?

0 Answers  


What are Modules in AngularJS?

1 Answers  






How event emitters works in angular 2?

0 Answers  


What is latest version of angular?

0 Answers  


What types of ngmodules?

0 Answers  


What is ng-app in angularjs?

0 Answers  


What is injector tree?

0 Answers  


How do you reference the host of a component?

0 Answers  


How do I increase my webpack speed?

0 Answers  


Categories