What is the difference between angular service and factory?



What is the difference between angular service and factory?..

Answer / Gurav Kumar

Both services and factories in AngularJS are used to organize code, manage dependencies, and provide shared functionality across different parts of an application. The main difference lies in how they create their instances. A factory creates a new instance every time it is called, while a service reuses the same instance as long as the application lives.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What are the advantages of angular 2 ?

1 Answers  


How will you convert a string into a percentage?

1 Answers  


How did you stop observable?

1 Answers  


What do you understand by $watch?

1 Answers  


How routing works in angular 2.?

1 Answers  


What is angular promise?

1 Answers  


How to preventdefault on anchor tags?

1 Answers  


How does the dom work?

1 Answers  


What are the differences between service and factory methods?

1 Answers  


How can you use “$rootscope” in angularjs?

1 Answers  


What are the differences between $resource and $http?

1 Answers  


Explain Authentication and Authorization?

1 Answers  


Categories