So, I have NgbModal with a form in it, and I want to achieve its closure upon successful submission.
This is my ModalComponent:
@Component({ selector: 'create-update-transaction', templateUrl: './CreateOrUpdateTransaction.html', providers: [AccountTransactionsService] }) export class CreateOrUpdateTransactionComponent { closeResult: string; modalRef: NgbModalRef; @Input() transaction: Transaction = new Transaction(); @Output() onSubmit: EventEmitter<void> = new EventEmitter<void>(); constructor(private modalService: NgbModal, private transactionsService: AccountTransactionsService) {} sendTransaction(): void{ let localModalRef = this.modalRef; this.transactionsService.createOrUpdateTransaction(this.transaction, (isSuccessful)=>{ if (isSuccessful) { this.onSubmit.emit(); localModalRef.close();
I get localModalRef.close is not a function error when I try to call the closure method of a saved NgbModalRef
source share