AngularJS : What is a factory?

前端 未结 4 1990
误落风尘
误落风尘 2020-12-12 09:37

I\'ve been doing a lot of work on Angular.js and overall I find it to be an interesting and powerful framework.

I know there have been a lot of discussio

4条回答
  •  粉色の甜心
    2020-12-12 09:51

    Services are mostly objects in which you describe the constructor class of the object. Somewhere deep within the framework, the Object.create() function is called and then you can use a service by calling its object and methods using a controller. Factory, on the other hand, doesn't create an object by default and hence requires you to return the entire object location once you're done defining all the attributes and methods.

提交回复
热议问题