PROVIDE A QUICK SUMMARY OF DIFFERENCES BETWEEN ANGULARJS SERVICE, PROVIDER AND FACTORY?

Provide a quick summary of differences between AngularJS Service, Provider and Factory?

Quick summary,
Service: create a new instance upon every injection. Utilize ‘this’ object inside the service
Syntax: module.service( ‘serviceName’, function );

Factory: return the value saved in factory object upon every injection. Need to create an object, add methods & properties to it and return that object.
Syntax: module.factory( ‘factoryName’, function );

Providers: Can be configured during the module configuration phase
yntax: module.provider( ‘providerName’, function );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>