I\'ve got a modal:
In my opinion: the modal is responsible for closing itself and not the caller of the modal.
A modal can simply access the NgbActiveModal class, through the injector, and close itself by either calling the close or dismiss function.
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
export class Modal {
constructor(private activeModal: NgbActiveModal) {
}
public submit() {
this.activeModal.close(/* your result */);
}
public close() {
this.activeModal.close();
}
}