diff --git a/packages/sitecore-jss-angular/src/components/placeholder.component.ts b/packages/sitecore-jss-angular/src/components/placeholder.component.ts index 369b89e624..efebdb8e9c 100644 --- a/packages/sitecore-jss-angular/src/components/placeholder.component.ts +++ b/packages/sitecore-jss-angular/src/components/placeholder.component.ts @@ -296,6 +296,7 @@ export class PlaceholderComponent implements OnInit, OnChanges, DoCheck, OnDestr // work-around for https://github.com/angular/angular/issues/12215 const createdComponentRef = this.view.createComponent(rendering.componentImplementation, { index: index, + ngModuleRef: rendering.componentModuleRef, }); if (this.parentStyleAttribute) { this.renderer.setAttribute( diff --git a/packages/sitecore-jss-angular/src/jss-component-factory.service.ts b/packages/sitecore-jss-angular/src/jss-component-factory.service.ts index b07e2af55a..91250d81fe 100644 --- a/packages/sitecore-jss-angular/src/jss-component-factory.service.ts +++ b/packages/sitecore-jss-angular/src/jss-component-factory.service.ts @@ -1,4 +1,4 @@ -import { Inject, Injectable, Injector, Type, createNgModule } from '@angular/core'; +import { createNgModule, Inject, Injectable, Injector, NgModuleRef, Type } from '@angular/core'; import { ComponentRendering, HtmlElementRendering } from '@sitecore-jss/sitecore-jss/layout'; import { ComponentNameAndModule, @@ -17,6 +17,7 @@ export interface ComponentFactoryResult { // eslint-disable-next-line @typescript-eslint/no-explicit-any componentImplementation?: Type; componentDefinition: ComponentRendering | HtmlElementRendering; + componentModuleRef?: NgModuleRef; canActivate?: | JssCanActivate | Type @@ -86,6 +87,7 @@ export class JssComponentFactoryService { return { componentDefinition: component, componentImplementation: componentType, + componentModuleRef: moduleRef, canActivate: lazyComponent.canActivate, resolve: lazyComponent.resolve, };