Topic: sidenav Module - ngFor Not Working
p4k1tz free asked 3 years ago
Expected behavior ngFor loop should run to generate nav items.
Actual behavior ngFor loop causes the item to not display at all.
Resources (screenshots, code snippets etc.)
<mdb-sidenav-layout>
<mdb-sidenav class="bg-dark" #sidenav="mdbSidenav" [hidden]="false"
scrollContainer="#scroll-container" mode=side color=primary>
<ul id="scroll-container" mdbScrollbar class="sidenav-menu bg-dark">
<a #sidenavToggle class="inline-block p-3" [routerLink]="[]" (click)="sidenav.toggleSlim()">
<i class="fas fa-angle-double-left"></i>
</a>
<a class="" slim="false">
<h3 id="sidenav-header" class="inline-block m-0 py-3 text-light align-middle" slim="false">Examples</h3>
</a>
<mdb-sidenav-item>
<a class="sidenav-link">
<i class="far fa-smile fa-fw me-3"></i><span slim="false">Link 1</span></a>
</mdb-sidenav-item>
<mdb-sidenav-item *ngFor="let category of categories">
<a class="sidenav-link" [routerLink]="">
<small slim="false" class="text-uppercase text-light">Category</small>
</a>
<ul class="sidenav-collapse" mdbCollapse>
<li class="sidenav-item">
<a class="sidenav-link">Link 2</a>
</li>
<li class="sidenav-item">
<a class="sidenav-link">Link 3</a>
</li>
</ul>
</mdb-sidenav-item>
<li class="sidenav-item" *ngFor="let category of categories">
<div>
<a class="sidenav-link active" href="/dashboard/832730685940432956">
<small slim="false" class="text-uppercase text-light">Category</small>
<i class="fas fa-angle-down rotate-icon" style="transform: rotate(180deg);"></i>
</a>
</div>
<ul mdbcollapse="" class="sidenav-collapse collapse show">
<li class="sidenav-item">
<a class="sidenav-link">Link 2</a>
</li>
<li class="sidenav-item">
<a class="sidenav-link">Link 3</a>
</li>
</ul>
</li>
</ul>
</mdb-sidenav>
<mdb-sidenav-content #sidenavContent>
<div class="bg-light text-dark d-flex flex-column min-vh-100">
<div class="container-fluid">
<button #sidenavToggle class="btn btn-primary" (click)="sidenav.toggle()">
<i class="fas fa-bars"></i>
</button>
<button #sidenavToggle class="btn btn-primary" (click)="sidenav.toggleSlim()">
toggle slim
</button>
</div>
<app-footer class="mt-auto"></app-footer>
</div>
</mdb-sidenav-content>
Is there documentation somewhere that I am missing?
Add comment
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
Resolved
Specification of the issue
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: MDB5 1.3.0
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No