userimage

what is the difference between Service vs provider vs factory in angular js

what is the difference between Service vs provider vs factory in angular js
userimage
In AngularJS difference between service vs factory vs provider:

Services
module.service( 'serviceName', function );
serviceName as an injectable argument you will be provided with an instance of the function. In other words new FunctionYouPassedToService().

Factories
module.factory( 'factoryName', function );
factoryName as an injectable argument you will be provided with the value that is returned by invoking the function reference passed to module.factory.

Providers
module.provider( 'providerName', function );
providerName as an injectable argument you will be provided with (new ProviderFunction()).$get(). The constructor function is instantiated before the $get method is called - ProviderFunction is the function reference passed to module. Provider have the advantage that they can be configured during the module configuration phase.

For sample code try this
Answer is