import { Component, OnDestroy, OnInit } from '@angular/core'; import { JhiAlertService } from 'ng-jhipster'; @Component({ selector: 'jhi-alert', template: ` ` }) export class JhiAlertComponent implements OnInit, OnDestroy { alerts: any[]; constructor(private alertService: JhiAlertService) {} ngOnInit() { this.alerts = this.alertService.get(); } setClasses(alert) { return { toast: !!alert.toast, [alert.position]: true }; } ngOnDestroy() { this.alerts = []; } }