Confused about Service vs Factory

后端 未结 20 2756
轻奢々
轻奢々 2020-11-22 08:49

As I understand it, when inside a factory I return an object that gets injected into a controller. When inside a service I am dealing with the object using this

20条回答
  •  無奈伤痛
    2020-11-22 09:17

    • With the factory you actually create an object inside of the factory and return it.
    • With the service you just have a standard function that uses the this keyword to define function.
    • With the provider there’s a $get you define and it can be used to get the object that returns the data.

提交回复
热议问题