Skip to content

Commit 452fb71

Browse files
authored
Merge pull request #5820 from IgniteUI/mvenkov/overlay-attach-to-accept-picked-type
Change the type of moduleRef param in attach method
2 parents 4c1643b + 64e6f0c commit 452fb71

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

projects/igniteui-angular/src/lib/grids/grid-base.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5890,9 +5890,13 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
58905890
(this as any).rootGrid ? (this as any).rootGrid.nativeElement : this.nativeElement;
58915891
this._advancedFilteringOverlaySettings.outlet = this.outletDirective;
58925892

5893-
this._advancedFilteringOverlayId =
5894-
this.overlayService.attach(IgxAdvancedFilteringDialogComponent, this._advancedFilteringOverlaySettings);
5895-
// , this._moduleRef);
5893+
this._advancedFilteringOverlayId = this.overlayService.attach(
5894+
IgxAdvancedFilteringDialogComponent,
5895+
this._advancedFilteringOverlaySettings,
5896+
{
5897+
injector: this.viewRef.injector,
5898+
componentFactoryResolver: this.resolver
5899+
});
58965900
this.overlayService.show(this._advancedFilteringOverlayId, this._advancedFilteringOverlaySettings);
58975901
}
58985902
}

projects/igniteui-angular/src/lib/services/overlay/overlay.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,14 @@ export class IgxOverlayService implements OnDestroy {
123123
* Generates Id. Provide this Id when call `show(id, settings?)` method
124124
* @param component Component Type to show in overlay
125125
* @param settings Display settings for the overlay, such as positioning and scroll/close behavior.
126-
* @param moduleRef Optional reference to the NgModule that can resolve the component's factory
126+
* @param moduleRef Optional reference to an object containing Injector and ComponentFactoryResolver
127+
* that can resolve the component's factory
127128
* @returns Id of the created overlay. Valid until `onClosed` is emitted.
128129
*/
129-
attach(component: Type<any>, settings?: OverlaySettings, moduleRef?: NgModuleRef<any>): string;
130-
attach(component: ElementRef | Type<any>, settings?: OverlaySettings, moduleRef?: NgModuleRef<any>): string {
130+
attach(component: Type<any>, settings?: OverlaySettings,
131+
moduleRef?: Pick<NgModuleRef<any>, 'injector' | 'componentFactoryResolver'>): string;
132+
attach(component: ElementRef | Type<any>, settings?: OverlaySettings,
133+
moduleRef?: Pick<NgModuleRef<any>, 'injector' | 'componentFactoryResolver'>): string {
131134
let info: OverlayInfo;
132135
info = this.getOverlayInfo(component, moduleRef);
133136

@@ -330,7 +333,7 @@ export class IgxOverlayService implements OnDestroy {
330333
}
331334
}
332335

333-
private getOverlayInfo(component: any, moduleRef?: NgModuleRef<any>): OverlayInfo {
336+
private getOverlayInfo(component: any, moduleRef?: Pick<NgModuleRef<any>, 'injector' | 'componentFactoryResolver'>): OverlayInfo {
334337
const info: OverlayInfo = { ngZone: this._zone };
335338
if (component instanceof ElementRef) {
336339
info.elementRef = <ElementRef>component;

0 commit comments

Comments
 (0)