What is the difference between Factory and Service Angular JS?
Answers
Answered by
0
Factory:
Factory is mostly preferable in all cases. It can be used when you have constructor function which needs to be instantiated indifferent controllers. Service is a kind of Singleton Object. The Object return fromService will be same for all controller.
2. Angular JS
In AngularJS, services are reusable singleton objects that are used to organize and share code across your app. They can be injected into controllers, filters, directives. AngularJS provides you three ways : service, factory and provider to create a service."
Factory is mostly preferable in all cases. It can be used when you have constructor function which needs to be instantiated indifferent controllers. Service is a kind of Singleton Object. The Object return fromService will be same for all controller.
2. Angular JS
In AngularJS, services are reusable singleton objects that are used to organize and share code across your app. They can be injected into controllers, filters, directives. AngularJS provides you three ways : service, factory and provider to create a service."
Similar questions
Social Sciences,
7 months ago
English,
7 months ago
Math,
7 months ago
Math,
1 year ago
Economy,
1 year ago