I read many stackoverflows posts and articles, all they say is angular service returns an instance whereas angular factory returns anything you want. What I want to know is, what is the thing than Service can do and factory can't do or vice-versa. If you say anything you can do with service can also be done with factory then why did Angular provided two things (Service, factory).
Asked
Active
Viewed 31 times
0
-
Do you even Google? – Lansana Camara Apr 11 '18 at 17:48
-
@Lansana I googled but didn’t find any answers. Seems like you know answer. Can you answer ? – D7thename Apr 11 '18 at 17:54
-
@Vikas if read my question carefully I asked about what is the thing you can achieve with service and not with factory. I didn’t asked about difference. – D7thename Apr 11 '18 at 17:57
-
@D7thename did you even care to go through the answer provided in that post? – Vikas Apr 11 '18 at 18:02
1 Answers
0
One of the main differences is in a factory you can run some initialization code before the factory object is returned.

Stradosphere
- 1,285
- 3
- 14
- 40