modal.service.ts 484 Bytes
import { Injectable, ViewChild } from '@angular/core';
import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ModalAlertComponent } from './modal-alert/modal-alert.component';

@Injectable({
  providedIn: 'root'
})
export class ModalService {

  constructor(private modalService: NgbModal) { }

  modalComponent: ModalAlertComponent;

  alert(texto: string) {
    return this.modalService.open(ModalAlertComponent).componentInstance.textoModal = texto;
  }
}