What is the type friendly injection?

后端 未结 4 451
忘了有多久
忘了有多久 2021-02-03 23:18

In the AngularJS documentation, there is an explanation of the differences between a factory, a service, a value, a constant and a provider .

At the end, we have a compa

4条回答
  •  爱一瞬间的悲伤
    2021-02-03 23:37

    Type here refers to:

    • primitives,
    • object literals,
    • functions, or
    • even an instance of a custom type

    Factories and Providers are most flexible out of the Service, Constant, Value in terms of what they bind to the injector. Hence Angular can detect the type of object/primitive that is bound to Service, Constant, Value hence friendlier since we know the type upfront (design/build time).

提交回复
热议问题