- 1
What is the difference between service and factory in angular js
3 Réponses
+ 2
Sachin Sharma Hope these resources will be helpful for you
http://www.simplygoodcode.com/2015/11/the-difference-between-service-provider-and-factory-in-angularjs/index.html
+ 1
https://www.codelord.net/2015/04/28/angularjs-whats-the-difference-between-factory-and-service/#:~:text=Factories%20vs.&text=That's%20for%20the%20gods%20of,used%20anywhere%20in%20our%20app.&text=Essentially%2C%20factories%20are%20functions%20that,instantiated%20with%20the%20new%20keyword.
Hope this helps you
+ 1
That's for the gods of Angular to know. They both allow us to create an object that can then be used anywhere in our app. Essentially, factories are functions that return the object, while services are constructor functions of the object which are instantiated with the new keyword.