nts-ng2-components
Version:
Paquete de componentes para Angular2 desarrollado por NITSNETS.
50 lines (37 loc) • 1.01 kB
text/typescript
import {
Component, Output, EventEmitter, ElementRef, AfterContentInit
} from '@angular/core';
export interface ToastOptions {showClose: boolean;}
({
selector: 'nts-toast',
templateUrl: 'toast.component.html',
styleUrls: ['toast.component.scss'],
})
export class NtsToastComponent implements AfterContentInit {
animateIn = false;
animateOut = false;
toastOptions:ToastOptions = null;
msg = '';
() accept = new EventEmitter();
constructor(private elementRef: ElementRef) { }
ngAfterContentInit() {
this.animateIn = false;
setTimeout(() => this.onEndAnimateOpen(), 50);
}
onEndAnimateOpen() {
this.animateIn = true;
}
initContent(options: ToastOptions) {
this.toastOptions = options;
}
setMessage(msg: string) {
this.msg = msg;
}
clickClose() {
this.accept.emit(true);
}
close() {
this.animateIn = false;
this.animateOut = true;
}
}