What is the difference between factory and service in angularjs?



What is the difference between factory and service in angularjs?..

Answer / Dilbagh Singh

Factory and Service are both used for dependency injection in AngularJS, but they differ in their usage. A factory returns a new object each time it is invoked, while a service returns a singleton instance (a single instance shared across the entire application). Factory can be useful when you need to create complex objects that require multiple functions or properties.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What is typings in angular 2?

1 Answers  


How to setup and install ionic framework with angular 4?

1 Answers  


What is AOT Compilation?

1 Answers  


What is the difference between angular 1(angularjs) and angular?

1 Answers  


What are the advantages of AngularJS?

1 Answers   SLK Software,


What is a selector?

1 Answers  


What is the difference between link and compile in angular.js?

1 Answers  


What is the factory method in angularjs?

1 Answers  


What is an interface in angular?

1 Answers  


What is compile function in angularjs?

1 Answers  


What is a service angular?

1 Answers  


Explain the difference between angular and angularjs?

1 Answers  


Categories