pcb demo code.
[ealt-edge.git] / example-apps / PDD / frontend-src / src / app / pcb / toast.service.ts
diff --git a/example-apps/PDD/frontend-src/src/app/pcb/toast.service.ts b/example-apps/PDD/frontend-src/src/app/pcb/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() { }
+}