0

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).

Vikas
  • 11,859
  • 7
  • 45
  • 69
D7thename
  • 21
  • 1
  • 7

1 Answers1

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