Browse Source

Synced destroying of toast and resetting data

pull/15071/head
Maksym Tsymbarov 7 months ago
parent
commit
c5c0c3ecb4
  1. 8
      ui-ngx/src/app/shared/components/toast.directive.ts

8
ui-ngx/src/app/shared/components/toast.directive.ts

@ -135,8 +135,11 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
notification: notificationMessage, notification: notificationMessage,
panelClass, panelClass,
destroyToastComponent: () => { destroyToastComponent: () => {
this.viewContainerRef.detach(0); if (this.toastComponentRef) {
this.toastComponentRef.destroy(); this.viewContainerRef.detach(0);
this.toastComponentRef.destroy();
this.toastComponentRef = null;
}
} }
}; };
const providers: StaticProvider[] = [ const providers: StaticProvider[] = [
@ -163,7 +166,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy {
clearTimeout(this.dismissTimeout); clearTimeout(this.dismissTimeout);
this.dismissTimeout = null; this.dismissTimeout = null;
} }
this.toastComponentRef = null;
this.currentMessage = null; this.currentMessage = null;
}); });
}); });

Loading…
Cancel
Save