UNPKG

ngx-toasty

Version:

Angular Toasty component shows growl-style alerts and messages for your web app

62 lines (61 loc) 2.87 kB
// Copyright (C) 2016 Sergey Akopkokhyants // This project is licensed under the terms of the MIT license. // https://github.com/cadulis/ngx-toasty import { Component, Input, Output, EventEmitter } from '@angular/core'; import { ToastData } from './toasty.service'; /** * A Toast component shows message with title and close button. */ var ToastComponent = (function () { function ToastComponent() { this.clickToastEvent = new EventEmitter(); this.closeToastEvent = new EventEmitter(); } /** * Event handler invokes when user clicks on toast. * This method emit new event into ToastyContainer to process click on toast. */ /** * Event handler invokes when user clicks on toast. * This method emit new event into ToastyContainer to process click on toast. */ ToastComponent.prototype.click = /** * Event handler invokes when user clicks on toast. * This method emit new event into ToastyContainer to process click on toast. */ function ($event) { $event.preventDefault(); this.clickToastEvent.next(this.toast); }; /** * Event handler invokes when user clicks on close button. * This method emit new event into ToastyContainer to close it. */ /** * Event handler invokes when user clicks on close button. * This method emit new event into ToastyContainer to close it. */ ToastComponent.prototype.close = /** * Event handler invokes when user clicks on close button. * This method emit new event into ToastyContainer to close it. */ function ($event) { $event.preventDefault(); this.closeToastEvent.next(this.toast); }; ToastComponent.decorators = [ { type: Component, args: [{ selector: 'ng2-toast', template: "\n <div class=\"toast\" [ngClass]=\"[toast.type, toast.theme]\" (click)=\"click($event)\">\n <div *ngIf=\"toast.showClose\" class=\"close-button\" (click)=\"close($event)\"></div>\n <div *ngIf=\"toast.title || toast.msg\" class=\"toast-text\">\n <span *ngIf=\"toast.title\" class=\"toast-title\" [innerHTML]=\"toast.title | safeHtml\"></span>\n <br *ngIf=\"toast.title && toast.msg\" />\n <span *ngIf=\"toast.msg\" class=\"toast-msg\" [innerHtml]=\"toast.msg | safeHtml\"></span>\n </div>\n </div>" },] }, ]; /** @nocollapse */ ToastComponent.ctorParameters = function () { return []; }; ToastComponent.propDecorators = { "toast": [{ type: Input },], "clickToastEvent": [{ type: Output, args: ['clickToast',] },], "closeToastEvent": [{ type: Output, args: ['closeToast',] },], }; return ToastComponent; }()); export { ToastComponent };