1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-14 11:23:17 +02:00
pigallery2/frontend/app/model/notification.service.ts
2017-07-08 12:43:42 +02:00

41 lines
805 B
TypeScript

import {Injectable, ViewContainerRef} from "@angular/core";
import {ToastsManager} from "ng2-toastr/ng2-toastr";
@Injectable()
export class NotificationService {
options = {
positionClass: "toast-top-center",
animate: "flyLeft"
};
constructor(private _toastr: ToastsManager) {
}
setRootViewContainerRef(vcr: ViewContainerRef) {
this._toastr.setRootViewContainerRef(vcr);
}
success(text, title = null) {
this._toastr.success(text, title, this.options);
}
error(text, title?) {
this._toastr.error(text, title, this.options);
}
warning(text, title?) {
this._toastr.warning(text, title, this.options);
}
info(text, title = null) {
this._toastr.info(text, title, this.options);
}
get Toastr(): ToastsManager {
return this._toastr;
}
}