mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
setComponentParameters from modal
This commit is contained in:
@@ -32,7 +32,8 @@ export class ModalComponent implements OnDestroy {
|
|||||||
document.body.removeChild(document.querySelector('.modal-backdrop'));
|
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.onShow.emit();
|
||||||
this.messagingService.send('modalShow');
|
this.messagingService.send('modalShow');
|
||||||
this.parentContainer = parentContainer;
|
this.parentContainer = parentContainer;
|
||||||
@@ -45,6 +46,9 @@ export class ModalComponent implements OnDestroy {
|
|||||||
|
|
||||||
const factory = this.componentFactoryResolver.resolveComponentFactory<T>(type);
|
const factory = this.componentFactoryResolver.resolveComponentFactory<T>(type);
|
||||||
const componentRef = this.container.createComponent<T>(factory);
|
const componentRef = this.container.createComponent<T>(factory);
|
||||||
|
if (setComponentParameters != null) {
|
||||||
|
setComponentParameters(componentRef.instance);
|
||||||
|
}
|
||||||
|
|
||||||
document.querySelector('.modal-dialog').addEventListener('click', (e: Event) => {
|
document.querySelector('.modal-dialog').addEventListener('click', (e: Event) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|||||||
Reference in New Issue
Block a user