UNPKG

angular2-simple-ui

Version:

Angular 2 Simple Material Design UI Components customisable with Simple 30 KB CSS with LESS support and full features support , just plugin up and run for clarity look at sample examples

42 lines (36 loc) 1.12 kB
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; @Component({ selector: 'sui-alert', templateUrl: './sui.alert.component.html', }) export class AlertComponent { @Input() message: string; @Input() type: AlertType; @Input() heading: string; @Input() headerClass: string; @Input() messageClass: string; @Input() alertClass: string; @Input() alertStyle: Object = {}; @Input() headingtStyle: Object = {}; @Input() messagetStyle: Object = {}; cssClass: string = ''; onClose(event: any) { this.message = ''; } getClass() { if (this.type === AlertType.success) { this.cssClass = 'sui-success'; } else if (this.type === AlertType.error) { this.cssClass = 'sui-danger'; } else if (this.type === AlertType.info) { this.cssClass = 'sui-info'; } this.cssClass = this.cssClass + ' ' + this.alertClass; return this.cssClass; } } export enum AlertType { success = 0, error = 1, info = 2 }