Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions projects/forge-angular/src/lib/dialog/dialog.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApplicationRef, DestroyRef, EmbeddedViewRef, EnvironmentInjector, Injectable, Injector, NgZone, Provider, createComponent, createEnvironmentInjector, inject } from '@angular/core';
import { ApplicationRef, Binding, DestroyRef, EmbeddedViewRef, EnvironmentInjector, Injectable, Injector, NgZone, Provider, createComponent, createEnvironmentInjector, inject } from '@angular/core';
import { Type, NgModuleRef } from '@angular/core';
import { IDialogProperties, defineDialogComponent } from '@tylertech/forge';
import { DIALOG_DATA, DialogConfig } from './dialog-config';
Expand All @@ -20,6 +20,8 @@ export interface IDialogServiceShowConfiguration<TModule = unknown> {
module?: NgModuleRef<TModule>;
injector?: EnvironmentInjector;
elementInjector?: Injector;
directives?: (Type<unknown> | {type: Type<unknown>; bindings: Binding[]})[];
bindings?: Binding[];
}

/**
Expand Down Expand Up @@ -68,7 +70,7 @@ export class DialogService {

private _showDialog<TComponent, TModule>(
component: Type<TComponent>,
{ config, data, injector, elementInjector, module, options }: IDialogServiceShowConfiguration<TModule>
{ config, data, injector, elementInjector, module, options, directives, bindings }: IDialogServiceShowConfiguration<TModule>
): DialogRef<TComponent> {
// Contains tokens that will be provided to components through our custom dialog injector
const providers: Provider[] = [];
Expand Down Expand Up @@ -113,7 +115,7 @@ export class DialogService {
this._ngZone.run(() => {
const parentInjector = injector ?? module?.injector ?? this._injector;
const environmentInjector = createEnvironmentInjector(providers, parentInjector);
const componentRef = createComponent(component, { environmentInjector, elementInjector });
const componentRef = createComponent(component, { environmentInjector, elementInjector, directives, bindings });
dialogRef.componentRef = componentRef;
dialogRef.componentInstance = componentRef.instance;
this._appRef.attachView(componentRef.hostView);
Expand Down
Loading