我有一个模态:
<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();
,但是this.warning.close is not a function
每当我单击是时都会得到。
我如何让它按照我想要的方式工作?