diff --git a/src/util/directives/showToast.directive.ts b/src/util/directives/showToast.directive.ts index 20642c146955b0785c97dd14202efe644b47bed1..a4e1756b33569325f19e252379ecf1d9b12cb69d 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