Newer
Older
HoteleriaAdmin / src / app / component / toast / toast.component.ts
James Cuadrado on 26 May 2021 769 bytes init
import { Component } from '@angular/core';

import { ToastService } from './toast.service';

@Component({
	selector: 'app-ng-toasts',
  	templateUrl: 'toast.component.html'
})

export class ToastComponent {
	constructor(public toastService: ToastService) {}

	show = true;
	showauto = false;
  	autohide = true;

  	close() {
	    this.show = false;
	    setTimeout(() => this.show = true, 5000);
  	}

  	showStandard() {
	    this.toastService.show('I am a standard toast');
	}

	  showSuccess() {
	    this.toastService.show('I am a success toast', { classname: 'bg-success text-light', delay: 10000 });
	}

	  showDanger(dangerTpl) {
	    this.toastService.show(dangerTpl, { classname: 'bg-danger text-light', delay: 15000 });
	}
}