Difference between services and factory.



Difference between services and factory...

Answer / Kamta Yadav

Both services and factories are used for dependency injection in AngularJS, but they differ in how instances are created. Factory creates a new instance every time it is invoked, while service reuses the same instance during its lifetime.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

What is hidden property in angular 2?

1 Answers  


What is a function decorator?

1 Answers  


Explain how does angularjs implement two-way binding?

1 Answers  


What is ng-init in angularjs?

1 Answers  


What is angular 5? What’s new in angular 5?

1 Answers  


How angular router works?

1 Answers  


How to redirect to 404 or other path if the path does not exist in angular 2?

1 Answers  


What are the core differences between observables and promises?

1 Answers  


What is post linking function in angularjs?

1 Answers  


Can we set an angular variable from php session variable without sending an http request?

1 Answers  


Explain the difference between constructor and ngoninit in angular 6?

1 Answers  


What are the new features of angular 2?

1 Answers  


Categories