I created an external window
in the Angular application, everything works fine but I want to close
the external window
after application logout
written the code below, I'm moving from 1 page to another page then the external window closing properly. If I press the logout button then the external window does not close
(ngOnDestroy
is not called in the case of application logout)
ngAfterViewInit() {
this.externalWindow = window.open('', '', `width=${this.wWidth},height=${this.wHeight},left=${this.wLeft},top=${this.wTop}`)
this.host = new DomPortalOutlet(
this.externalWindow.document.body,
this.componentFactoryResolver,
this.applicationRef,
this.injector
)
this.host.attach(this.portal)
}
ngOnDestroy() {
this.externalWindow.close()
}