I have been working on creating a page that displays a list of items. Each item, when clicked, triggers a ng2-bootstrap modal to show detailed information about that specific item. However, I encountered an issue when attempting to use (click)="lgModal.show()" outside of the button element. The modal was not responsive to clicks outside the overlay or the little x button for closing. The only way to close the modal was by pressing the 'Escape' key. Here is an example of the code:
<li (click)="lgModal.show()" *ngFor="let item of Items"> {{ item }}
<div bsModal #lgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" (click)="lgModal.hide()" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">Large modal</h4>
</div>
<div class="modal-body">
...
</div>
</div>
</div>
</div>
</li>
Is there a way to remove the button and place the (onclick) function outside of it? Large modal