Mercurial > hg > ugly-duckling
view src/app/services/notifications/notifications.service.ts @ 493:7f9fb84816b9
Introduce a singleton / service for communicating errors / or other notifications (there aren't any yet) - using MdSnackBar internally.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Thu, 06 Jul 2017 19:47:18 +0100 |
parents | |
children | cf4a17efb5d4 |
line wrap: on
line source
/** * Created by lucast on 06/07/2017. */ import {Injectable} from '@angular/core'; import {MdSnackBar} from '@angular/material'; @Injectable() export class NotificationService { constructor(private snackBar: MdSnackBar) {} displayError(message: string): void { // TODO perhaps actual distinguish this as an error? this.displayMessage(message); } private displayMessage(message: string): void { this.snackBar.open(message, 'Dismiss', {duration: 5000}); }; }