I've encountered numerous inquiries about modal not displaying, and although I've successfully implemented it in other scenarios, this one presents a unique challenge!
In my Wordpress
project, I've embedded an Angular
app within the admin area. The app utilizes Bootstrap 4
. To prevent the Bootstrap 4
CSS from affecting the Wordpress
admin interface when the Angular
app loads, I devised a technique. I wrapped the app in a div
with the class="bootstrap"
and utilized less
to encapsulate all Bootstrap styles within the .bootstrap
class. This ensures that classes like .text-danger
are written as .bootstrap .text-danger
, effectively isolating the Angular app without impacting the admin interface.
However, I encountered an issue when attempting to integrate ngb-modal
into the mix! The modal and its backdrop elements are added directly before the body tag, outside of the Bootstrap wrapper div
. As a result, the isolated CSS does not apply to these elements.
Is there a way to incorporate a wrapping div
element when calling the modal, like so:
<div class="bootstrap">...ngb-modal code here...</div>
?
const modalRef = this.modalService.open(MyModalComponent);
I hope I've articulated the issue effectively!