diff --git a/src/toaster-container.component.ts b/src/toaster-container.component.ts index 48ee297f..c4279b56 100644 --- a/src/toaster-container.component.ts +++ b/src/toaster-container.component.ts @@ -205,7 +205,7 @@ export class ToasterContainerComponent { } ngOnDestroy() { - this.addToastSubscriber.unsubscribe(); - this.clearToastsSubscriber.unsubscribe(); + if(this.addToastSubscriber) { this.addToastSubscriber.unsubscribe(); } + if(this.clearToastsSubscriber) { this.clearToastsSubscriber.unsubscribe(); } } -} \ No newline at end of file +}