Function inject

  • Given a set of modules, the inject function returns a lazily evaluated injector that injects dependencies into the requested service when it is requested the first time. Subsequent requests will return the same service.

    In the case of cyclic dependencies, an Error will be thrown. This can be fixed by injecting a provider () => T instead of a T.

    Please note that the arguments may be objects or arrays. However, the result will be an object. Using it with for..of will have no effect.

    Type Parameters

    • I1
    • I2
    • I3
    • I4
    • I5
    • I6
    • I7
    • I8
    • I9
    • I

    Parameters

    • module1: Module<I, I1>

      first Module

    • Optionalmodule2: Module<I, I2>

      (optional) second Module

    • Optionalmodule3: Module<I, I3>

      (optional) third Module

    • Optionalmodule4: Module<I, I4>

      (optional) fourth Module

    • Optionalmodule5: Module<I, I5>

      (optional) fifth Module

    • Optionalmodule6: Module<I, I6>

      (optional) sixth Module

    • Optionalmodule7: Module<I, I7>

      (optional) seventh Module

    • Optionalmodule8: Module<I, I8>

      (optional) eighth Module

    • Optionalmodule9: Module<I, I9>

      (optional) ninth Module

    Returns I

    a new object of type I