Injects the instance associated with the given class, or undefined if the class is not registered in the container.
undefined
Compared to optional, optionalBy accepts a thisArg argument (the containing class) which is used to resolve circular dependencies.
optionalBy
thisArg
The containing instance, used to help resolve circular dependencies.
The class to resolve.
Optional
The name qualifier of the class to resolve.
Injects the value associated with the given token, or undefined if the token is not registered in the container.
The token to resolve.
The name qualifier of the token to resolve.
Injects the instance associated with the given class, or
undefined
if the class is not registered in the container.Compared to optional,
optionalBy
accepts athisArg
argument (the containing class) which is used to resolve circular dependencies.