我有一个模态:
<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>
每当我单击"是"时,我都希望它调用函数并自行关闭.
在我的控制器中,我有@ViewChild('warningModal') warning;
,在submit()
中,我有this.warning.close();
,但每当我单击Yes时,我都会得到this.warning.close is not a function
.
我如何让它按我想要的方式工作?