modal.service.ts
517 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) {
let modal = this.modalService.open(ModalAlertComponent)
modal.componentInstance.textoModal = texto;
return modal;
}
}