Topic: Hide
allancmello
pro premium asked 2 days ago
Is it possible to hide the "mdb-sidenav-content" tag when hiding the sidenav?
See sidenav example 4 in the doc, "MDB navigation" to understand what's expected. When closing sidenav.close(), will "mdb-sidenav-content" also be hidden?
https://mdbootstrap.com/docs/angular/navigation/sidenav/#subsection-mdb-navigation
Kamila Pieńkowska
staff answered a day ago
By design, sidenav.hide()
only hides the <mdb-sidenav>
panel.
The <mdb-sidenav-content>
is meant to hold your main page content, so it always stays visible.
If you want to hide both the sidenav and the content together, you’ll need to control mdb-sidenav-content
yourself – for example with *ngIf or toggling a CSS class that hides along with the sidenav.
allancmello
pro premium answered a day ago
I tried using *ngIf
, and it doesn't work.
It seems that the state of <mdb-sidenav-content>
is internally linked to sidenav
.
I use a boolean variable signals to control the display of the <mdb-sidenav-content>
.
Result, *ngIf
or @if()
enters an eternal loop!
<mdb-sidenav-content #sidenavContent *ngIf="!sharedService.isPdv()">
<nav id="main-navbar" class="navbar navbar-expand-lg bg-white fixed-top navCss">
<div class="container-fluid">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
</ol>
</nav>
See te image:
allancmello
pro premium answered a day ago
Hi Kamila,
I found the problem.
*ngIf
must be inserted in the tag <nav>
and not in the tag:
<mdb-sidenav-content>
Its work!
Here:
<mdb-sidenav-content #sidenavContent>
<nav id="main-navbar" class="navbar navbar-expand-lg bg-white fixed-top navCss"
*ngIf="!sharedService.isPdv()">
<div class="container-fluid">
Closed topic.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: Yes
- Technology: MDB Angular
- MDB Version: MDB5 8.0.0
- Device: All
- Browser: All
- OS: All
- Provided sample code: No
- Provided link: No