Home page carousel
[eliot.git] / blueprints / common / eliot-ui / frontend-src / src / app / deployments / toast.service.ts
diff --git a/blueprints/common/eliot-ui/frontend-src/src/app/deployments/toast.service.ts b/blueprints/common/eliot-ui/frontend-src/src/app/deployments/toast.service.ts
new file mode 100644 (file)
index 0000000..8cda912
--- /dev/null
@@ -0,0 +1,17 @@
+import { Injectable, TemplateRef } from '@angular/core';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class ToastService {
+  toasts: any[] = [];
+
+  show(textOrTpl: string | TemplateRef<any>, options: any = {}) {
+    this.toasts.push({ textOrTpl, ...options });
+  }
+
+  remove(toast) {
+    this.toasts = this.toasts.filter(t => t !== toast);
+  }
+  constructor() { }
+}