angular2-boiler-plate
Version:
Angular 2 Boiler plate that integrated with WebPack, TypeScript, DatePicker, RxJs for Reactive Extensions in Java Script , Karma , Jasmine for unit testing , WebKit ,protractor e2e testing
41 lines (36 loc) • 1.13 kB
text/typescript
import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
export class Alertomponent implements OnInit {
message: string;
type: AlertType;
heading: string;
headerClass: string;
messageClass: string;
alertClass: string;
alertStyle: Object={};
headingtStyle: Object={};
messagetStyle: Object={};
isClosed: boolean = false;
cssClass: string = '';
onClose(event: any) {
this.isClosed = true;
}
ngOnInit() {
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;
}
}
export enum AlertType {
success = 0,
error = 1,
info = 2
}