What is a factory? What is the difference between service and factory

devquora
devquora

Posted On: Feb 22, 2018

 

A factory(.factory) is a method on our module which takes a name and a function, that defines the factory. We can inject it in our controllers, directives, filters etc and use its properties or methods. A factory and service are the same i.e. their usage and purpose are the same. The one difference however in them is that service is a constructor function but a factory is not.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    AngularJS Basic Interview Questions

    What is AngularJS?

    AngularJS is a javascript framework which helps in developing web applications in MVC architectural pattern & SPA or..

    AngularJS Basic Interview Questions

    What are angular directives?

    Angular directives are the attributes which are decorated on the html tags or elements of an html page. Directives have ..

    AngularJS Basic Interview Questions

    What are custom directives?

    Angular provides the ability to create our own directives to implement our own custom templates or logic in our web appl..