I tried to add an overlay to a component when i click a button like this example :
https://stackblitz.com/edit/overlay-demo-fv3bwm?file=app/app.component.ts
but after adding it to my component the overlay elements ( in my case just a textarea element ) is displayed under my rendered sidebar template and not over the rendered router-outlet component.
this is my sidebar template:
<div class="d-flex" id="wrapper">
<!-- Sidebar -->
<div class="bg-light border-right" id="sidebar-wrapper">
<div class="sidebar-heading" > <a routerLink="">
<img style="width: 200px;" src="../../../assets/images/logo">
<br> <h4>App</h4></a></div>
<div class="list-group">
<a routerLink="requirements" routerLinkActive="active"
class="list-group-item list-group-item-action bg-light">Component1</a>
<a routerLink="dataset" routerLinkActive="active"
class="list-group-item list-group-item-action bg-light">Comonent2</a>
<a routerLink="dag" routerLinkActive="active"
class="list-group-item list-group-item-action bg-light">Comonent3</a>
<a routerLink="tasks" routerLinkActive="active"
class="list-group-item list-group-item-action bg-light">Comonent4</a>
</div>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<nav class="navbar navbar-expand navbar-light bg-light border-bottom">
<button class="btn btn-primary" id="menu-toggle"><i class="bi-arrow-right"></i>Toggle Menu</button>
<div class="collapse navbar-collapse " id="navbarSupportedContent">
<ul class="navbar-nav ml-auto mt-2 mt-lg-0 ">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item text-center" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-center text-secondary" (click)="onLogout()">Logout</a>
</div>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<router-outlet></router-outlet>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
I have encountered a similar issue when I tried to split the sidebar from my router-outlet by removing the router-outlet from my sidebar component and adding it to app component :
<app-sidebar></app-sidebar>
<router-outlet><router-outlet>
but ended up keeping the side bar template above (with the router-outlet tag) and just keeping the app-sidebar tag in my app component:
<app-sidebar></app-sidebar>
In this image, the red mark is where I wanted the overlay to be shown and the black mark is where it actually is.
Inspect overlay
Edit:
This is the issue reproduced in a stackblitz project (the overlay button is in part 1 nav link ):
https://stackblitz.com/edit/angular-crud-deborahk-axtfg7?file=src%2Fapp%2Fapp.module.ts
I also figured that the overlay is not working, its not only a sidebar problem I can click on the overlay button and it keeps creating the templates over and over again.
Here you can see my sidebar where i marked the black cross and how the overlay is being displayed
overlay output
*Note: the stackblitz example is on angular 9 while I'm working with angular 11*