You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here we expect foobar in the document body, but instead get Dependency ServiceB is not found and TypeError: Cannot read property 'bar' of undefined respectively. But if change toFactory(() => new ServiceB()) to toClass(ServiceB) (or simple ServiceB but I prefer to pass binding explicitly) everything works fine.
Looks like saving the injector to an instance is implemented only in toClass binding, is it by design? Maybe we can lift it up to asBinding utility? BTW it still work if serviceB is accessed (or injected directly) during instantiating of ServiceA by saving the injector to currentInjector variable under the hood:
A minimal reproducible demo:
Here we expect
foobar
in the document body, but instead getDependency ServiceB is not found
andTypeError: Cannot read property 'bar' of undefined
respectively. But if changetoFactory(() => new ServiceB())
totoClass(ServiceB)
(or simpleServiceB
but I prefer to pass binding explicitly) everything works fine.Looks like saving the injector to an instance is implemented only in
toClass
binding, is it by design? Maybe we can lift it up toasBinding
utility? BTW it still work if serviceB is accessed (or injected directly) during instantiating ofServiceA
by saving the injector tocurrentInjector
variable under the hood:The text was updated successfully, but these errors were encountered: