I cannot seem to figure out a solution for the following issue: I have two sibling div elements. The second one contains a button that triggers a modal dialog with a dark overlay. However, in my case, the first div appears on top of the modal dialog due to stacking order. While I understand the concept behind this, I need to find a workaround without altering the existing structure.
The modal dialog has a boolean attribute named "opened". Is there a way for me to dynamically monitor the value of this attribute and use ngClass to adjust the z-index of the second sibling element to ensure it is always displayed above all other elements when the modal is open? This adjustment should be removed once the modal is closed.
Any suggestions or assistance would be greatly appreciated.
<div style='z-index: 2'></div>
<div style='z-index: 1'>
<button (click)="openModal()">Open modal</button>
<div id="modal" style='z-index: 3'>Here is the modal content</div>
</div>