What is the difference between Factory, Service and Provider?
Answer Posted / 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 View All Answers
Explain ng-click directive?
In collection of array how to collect all the true state from active true and active false?
Explain why there are two “destroy” events associated with the termination of scope in angularjs?
Difference between directive and pipe in angular?
What is ng-cloak directive and why we use?
How would you optimize the angular 2 application for better performance?
What are the advantages of token-based authentication?
List at down the ways in which you can communicate between applications modules using core angular functionality.
How to catch and log specific angular errors in your app?
What is difference between ng if and ng show?
What is ng init?
Which is better react or angular?
How $location is different from window.location in angularjs?
Is angularjs extensible?
What are $scope in angular js?