I've got a modal:
<template #warningModal let-c="close" let-d="dismiss">
<div class="modal-header">
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Warning</h4>
</div>
<div class="modal-body">
The numbers you have entered result in negative expenses. We will treat this as $0.00. Do you want to continue?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="c('Close click')">No</button>
<button type="button" class="btn btn-secondary" (click)="submit()">Yes</button>
</div>
</template>
Whenever I click yes, I want it to call a function and close itself.
In my controller, I have @ViewChild('warningModal') warning;
and in submit()
, I have this.warning.close();
, but I get this.warning.close is not a function
whenever I click Yes.
How do I get this to work the way I want it to?
question from:
https://stackoverflow.com/questions/40382319/how-to-programmatically-close-ng-bootstrap-modal 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…