Created
May 4, 2018 13:47
-
-
Save matheusmurta/f8aa1856c8b568d1cac6ac5c5e184659 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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ê'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment