mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
setComponentParameters from modal
This commit is contained in:
parent
4bf44fa5b8
commit
ff13cb2838
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user