Sharing Top Content from the Angular-sphere.

Service vs Factory – Once and for all

  • A factory function is really just a function that gets called, which is why we have to return an object explicitly.
  • It turns out, a service is a constructor function whereas a factory is not.
  • It takes the name and the factory function that is passed and basically returns a provider with the same name, that has a $get method which is our factory function.

Read the full article, click here.


@Roymj88: “One of the best explanations that i have come across: #ServiceVsFactory @angularjs”


Yes, this is yet another article on services vs factories in AngularJS. Why is that? Well… it turns out that despite the fact that this question pops up every week or so, it also turns out that the current web doesn’t really promote the actual best practice. This article explains once and for all, what the difference between services and factories is and why you should use service.


Service vs Factory – Once and for all

Comments are closed, but trackbacks and pingbacks are open.