1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x 16x 3x | import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; export interface IFlashMessageOptions { classes?: string[]; timeout?: number; } export interface IFlashMessage { text: string; options?: IFlashMessageOptions; timestamp?: number; } Injectable(); export class FlashMessagesService { public message = new Subject<IFlashMessage>(); show(text: string, options: IFlashMessageOptions = {}) { this.message.next(<IFlashMessage>{ text, options }); } } |