runInInjectionContext
Runs the given function in the context of the given
Injector
.
runInInjectionContext<ReturnT>(injector: Injector, fn: () => ReturnT): ReturnT
Parameters
injector
|
Injector |
the injector which will satisfy calls to |
fn
|
() => ReturnT |
the closure to be run in the context of |
Returns
ReturnT
: the return value of the function, if any
Description
Within the function's stack frame, inject
can be used to inject dependencies
from the given Injector
. Note that inject
is only usable synchronously, and cannot be used in
any asynchronous callbacks or after any await
points.