Skip to content
This repository has been archived by the owner on Jun 17, 2022. It is now read-only.

Commit

Permalink
setComponentParameters from modal
Browse files Browse the repository at this point in the history
  • Loading branch information
kspearrin committed Jul 25, 2019
1 parent 4bf44fa commit ff13cb2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/angular/components/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export class ModalComponent implements OnDestroy {
document.body.removeChild(document.querySelector('.modal-backdrop'));
}

show<T>(type: Type<T>, parentContainer: ViewContainerRef, fade: boolean = true): T {
show<T>(type: Type<T>, parentContainer: ViewContainerRef, fade: boolean = true,
setComponentParameters: (component: T) => void = null): T {
this.onShow.emit();
this.messagingService.send('modalShow');
this.parentContainer = parentContainer;
Expand All @@ -45,6 +46,9 @@ export class ModalComponent implements OnDestroy {

const factory = this.componentFactoryResolver.resolveComponentFactory<T>(type);
const componentRef = this.container.createComponent<T>(factory);
if (setComponentParameters != null) {
setComponentParameters(componentRef.instance);
}

document.querySelector('.modal-dialog').addEventListener('click', (e: Event) => {
e.stopPropagation();
Expand Down

0 comments on commit ff13cb2

Please sign in to comment.