import { Component, Input, OnInit } from '@angular/core'; @Component({ selector: 'onguard-message', templateUrl: './message.component.html', styleUrls: ['./message.component.scss'] }) export class MessageComponent implements OnInit { @Input() type: 'error' | 'warning' | 'info' | 'success'; @Input() message: string; @Input() closeable: boolean; @Input() closeCallback: ()=>void; constructor() { } ngOnInit(): void { } public hasMessage(): boolean { if (this.message && this.message.length && this.type) { return true; } return false; } public isCloseable(): boolean { let closeable = false; if (this.closeable && this.closeable === true) { closeable = true; } return closeable; } public close() { this.message = ''; if (this.closeCallback) { this.closeCallback(); } } }