@HostListener('mouseout') mouseout() { this.destroy(); } destroy() { this.componentRef && this.componentRef.destroy(); this.componentRef = null; } ngOnDestroy() { this.destroy(); }