diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts index e7cd005990e..818b44bf971 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts @@ -71,7 +71,7 @@ export class ToasterService { message, title, severity, - options: { closable: true, ...options, id }, + options: { closable: true, id, ...options }, }); this.toasts$.next(this.toasts); return id; @@ -89,8 +89,8 @@ export class ToasterService { /** * Removes all open toasts at once. */ - removeAll() { - this.toasts = []; + clear(key?: string) { + this.toasts = !key ? [] : this.toasts.filter(toast => toast.options.containerKey !== key); this.toasts$.next(this.toasts); } }