As a beginner or intermediate, a lot of JavaScript developers tends to get confused between two most vital components of AngularJS – Service and Factory.
Reason, both tend to do kind of similar job, well it looks like initially when we can’t really distinguish the proper usage. I too had these confusions and few of my colleagues happen to ask me this particular question often and often. So here I am, compiled the list of very good writings – this will give you a perfect answer on what are AngularJS Service or Factory, how to use them, what are the differences etc.
- Answer by Doug T on StackExchange
- Usage example by Gil
- A StackExchange Community Wiki
- AngularJS: Factory vs Service vs Provider by Tyler (He has got a cool website, check that out)
- AngularJS Service vs Factory – video by DevelopMentor
I hope, after going through those Q/As and the video if you were still in doubt – you have a clear picture of what Service and Factory are made for in AngularJS.