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
Using share-lib-between-app-and-plugins branch, when defining an InjectionToken that injected into a shared service and provided in the AppModule's NgModule.providers is not injected into the service called from within the plugins throwing
ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[InjectionToken test]:
...
NullInjectorError: No provider for InjectionToken test!
export class AppComponent implements OnInit {
constructor(
private injector: Injector,
private pluginLoader: PluginLoaderService,
private ts: TestService) {}
ngOnInit() {
console.log(this.ts.test()); // <-- Works as expected
...
Plugin 1:
export class Plugin1Component implements OnInit {
x = false;
constructor(private ts: TestService) {}
ngOnInit() {
console.log(this.ts.test()); // <-- Throws
...
It looks like plugin's injector is trying to create a new instance of the service and when trying to resolve the dependency for the injected token it thinks that it's another token, not the one that was provided in the AppModule... Any ideas how this can be resolved will be very welcomed.
The text was updated successfully, but these errors were encountered:
Using share-lib-between-app-and-plugins branch, when defining an
InjectionToken
that injected into a shared service and provided in theAppModule
'sNgModule
.providers
is not injected into the service called from within the plugins throwingshared:
AppModule:
AppComponent:
Plugin 1:
It looks like plugin's injector is trying to create a new instance of the service and when trying to resolve the dependency for the injected token it thinks that it's another token, not the one that was provided in the AppModule... Any ideas how this can be resolved will be very welcomed.
The text was updated successfully, but these errors were encountered: