Skip to content

Instantly share code, notes, and snippets.

@kristofdegrave
kristofdegrave / lazy-ng-module-with-providers.factory.ts
Last active March 24, 2023 16:12
NgModuleFactory that can handle ModuleWithProviders in a lazy loaded context (https://github.com/angular/angular/issues/34351)
class LazyNgModuleWithProvidersFactory<T> extends NgModuleFactory<T> {
constructor(private moduleWithProviders: ModuleWithProviders<T>) {
super();
}
get moduleType() {
return this.moduleWithProviders.ngModule;
}
create(parentInjector: Injector | null) {