From 609fff2245d03f14a39c36fb1979657e49e84eca Mon Sep 17 00:00:00 2001 From: Xiao Gui <xgui3783@gmail.com> Date: Thu, 22 Nov 2018 11:24:15 +0100 Subject: [PATCH] bugfix: citation gets destroyed after template switch --- src/util/directives/showToast.directive.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/util/directives/showToast.directive.ts b/src/util/directives/showToast.directive.ts index 20642c146..a4e1756b3 100644 --- a/src/util/directives/showToast.directive.ts +++ b/src/util/directives/showToast.directive.ts @@ -1,11 +1,11 @@ -import { Directive, Input, TemplateRef, HostListener } from "@angular/core"; +import { Directive, Input, TemplateRef, HostListener, OnDestroy } from "@angular/core"; import { ToastService } from "../../services/toastService.service"; @Directive({ selector: '[showToast]' }) -export class ShowToastDirective{ +export class ShowToastDirective implements OnDestroy{ @Input() showToast : string | TemplateRef<any> = null @@ -41,4 +41,8 @@ export class ShowToastDirective{ constructor(private toastService:ToastService){ } + + ngOnDestroy(){ + if(this.dismissHandler) this.dismissHandler() + } } \ No newline at end of file -- GitLab