import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy, } from '@angular/core'; import {Ng2vAlertConfig} from './alert-config'; /** * Alerts can be used to provide feedback messages. */ @Component({ selector: 'ng2v-alert', changeDetection: ChangeDetectionStrategy.OnPush, template: `
` }) export class Ng2vAlert { /** * A flag indicating if a given alert can be dismissed (closed) by a user. If this flag is set, a close button (in a * form of an ×) will be displayed. */ @Input() dismissible: boolean; /** * Alert type (CSS class). Bootstrap 4 recognizes the following types: "success", "info", "warning" and "danger". */ @Input() type: string; /** * An event emitted when the close button is clicked. This event has no payload. Only relevant for dismissible alerts. */ @Output() close = new EventEmitter(); constructor(config: Ng2vAlertConfig) { this.dismissible = config.dismissible; this.type = config.type; } closeHandler() { this.close.emit(null); } }