Browse Source

feat(theme-shared): add clear toasts by key functionality

related issue: #2537
pull/2606/head
TheDiaval 7 years ago
parent
commit
72fee038a5
  1. 6
      npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts

6
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);
}
}

Loading…
Cancel
Save