Angular 2 Sample: Wrapping toastr in a Service - Tuong-Nguyen/Angular-D3-Cometd GitHub Wiki

A service which wrap toastr library

declare const toastr: any;

@Injectable()
export class ToastrService {
  public success(message: string, title?: string) {
    toastr.success(message, title);
  }

  public info(message: string, title?: string) {
    toastr.info(message, title);
  }

  public warning(message: string, title?: string) {
    toastr.warning(message, title);
  }

  public error(message: string, title?: string) {
    toastr.error(message, title);
  }
}