Injects the instance associated with the given class.
Throws an error if the class is not registered in the container.
Optionalname: stringInjects all instances provided by the registrations associated with the given class.
Throws an error if the class is not registered in the container.
Injects the instance associated with the given class,
or undefined if the class is not registered in the container.
Optionalname: stringInjects all instances provided by the registrations associated with the given class or an empty array if the class is not registered in the container.
Runs a function inside the injection context of this injector.
Note that injection functions (inject, injectAll, optional, optionalAll)
are only usable synchronously: they cannot be called from asynchronous callbacks
or after any await points.
The function to be run in the context of this injector.
The return value of the function, if any.
Allows performing injections outside the normal injection context window.
Example