Ejemplo Modal Confirm

* Definir modal confirm

import {Component, Input} from '@angular/core';

import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';

@Component({
  selector: 'app-modal-confirm',
  templateUrl: './modal-confirm.component.html'
})
export class ModalConfirmComponent {
  @Input() name;

  constructor(public activeModal: NgbActiveModal) {}
}
< div class="modal-header">
  < h4 class="modal-title">Eliminar< /h4>
  < button type="button" class="close" aria-label="Close" (click)="activeModal.dismiss('Cross click')">
    < span aria-hidden="true">×< /span>
  < /button>
< /div>
< div class="modal-body">
  < p>{{name | json}}< /p>
< /div>
< div class="modal-footer">
  < button type="button" class="btn btn-success" (click)="activeModal.close(true)">Si< /button>
  < button type="button" class="btn btn-danger" (click)="activeModal.close(false)">No< /button>
< /div>
  //app.module.ts
  declarations: [ModalConfirmComponent],
  entryComponents: [ModalConfirmComponent],

* Uso de modal confirm

import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
import {ModalConfirmComponent} from '../modal-confirm/modal-confirm.component';
...
  constructor(protected dd: DataDefinitionService, protected modalService: NgbModal) { }


  abrirModalConfirm(index:number) {
    const modalRef = this.modalService.open(ModalConfirmComponent);
    modalRef.componentInstance.name = this.rows[index]; //pasar parametros al modal confirm

    modalRef.result.then( //obtener resultados del modal confirm
      (result) => { console.log(result); },
      (reason) => { console.log(reason); }
    );
  }