What is the difference between service and factory in angular js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What is the difference between service and factory in angular js

30th Jan 2021, 1:25 AM
Sachin Sharma
Sachin Sharma - avatar
3 Answers
30th Jan 2021, 5:54 AM
R💠🇮🇳
R💠🇮🇳 - avatar
+ 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
30th Jan 2021, 5:51 AM
Atul [Inactive]
+ 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.
30th Jan 2021, 6:59 AM
Abhiyantā
Abhiyantā - avatar