import { Component, ViewContainerRef } from '@angular/core';
import { ToastsManager } from 'ng2-toastr/ng2-toastr';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(public toastr: ToastsManager, vcr: ViewContainerRef) {
this.toastr.setRootViewContainerRef(vcr);
}
showSuccess() {
this.toastr.success('Operação realizada com sucesso !', 'Success!');
}
showError() {
this.toastr.error('Erro ao realizar a operação!', 'Oops!');
}
showWarning() {
this.toastr.warning('Preencha os campos corretamente.', 'Alerta!');
}
showInfo() {
this.toastr.info('Informação para você');
}
}