1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

setComponentParameters from modal

This commit is contained in:
Kyle Spearrin 2019-07-25 12:22:22 -04:00
parent 4bf44fa5b8
commit ff13cb2838

View File

@ -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;
@ -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();