I want to capture the close event of bootstrap modal dialog to do some jobs, but don't know how to do this. My first thought was to bind event to the buttons, but it was a little bit ineffective since the dialog could be closed when click outside of the dialog box. I've searched and gathered a few solutions but some didn't work or were irrelevant to Angular 6. Hope someone here knows how to do. Thanks a lot!
Here is my modal:
<div class="modal fade" id="listNamecardShare" tabindex="-1" role="dialog" aria-labelledby="listNamecardShareTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="listNamecardShareTitle">Select namecards to share</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table table-hover">
<thead>
<tr>
<th>Fullname</th>
<th>Company</th>
<th>Select</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of namecards">
<td>{{ item.fullname }}</td>
<td>{{ item.company }}</td>
<td><input type="checkbox" [(ngModel)]="selected[namecards.indexOf(item)]"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary fas fa-paper-plane" data-dismiss="modal" (click)="onClickSend()"> Send</button>
</div>
</div>
</div>
</div>
hidden.bs.modalwhere you can hook up with RxJSfromEventand be able to subscribe to that event - dK-backdrop: "static"you can prevent from closing the modal when clicking outside. More info - w3schools.com/bootstrap/… and - w3schools.com/bootstrap/… - Alok Mali