midAngularJS
What is difference between service and factory in AngularJS?
Updated May 15, 2026
Short answer
Service uses constructor function; factory returns object.
Deep explanation
Factories give more flexibility, services are instantiated with new keyword.
Real-world example
API service abstraction.
Common mistakes
- Confusing both usage patterns.
Follow-up questions
- When to use factory?