What is the type friendly injection?

后端 未结 4 452
忘了有多久
忘了有多久 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:25

    My interpretation of "type friendly injection":

    Factories and Providers inject whatever is returned by the factory function and $get function respectively, which could be of any type and could potentially change dynamically at runtime. Whereas Service, Constant and Value injections are of a fixed type that Angular is aware of as it is well defined during the definition of the recipe. Hence they are type friendly injections.

提交回复
热议问题