I have a bootstrap 4 navbar with a dropdown, the dropdown contains the routes and I can get those to appear active based on the 'routerLinkActive' but I also want to style the 'dropdown-toggle' or 'nav-item' as active when one of its children is the active route.
How would i go about doing this ?
Here is a small snippet of the code, I have tried to clean it up for ease of reading
<li *ngFor="let menuItem of MenuItems; index as i" [id]="i" class="nav-item dropdown" ngbDropdown>
<a class="nav-link dropdown-toggle" ngbDropdownToggle>
{{menuItem.title}}
</a>
<!-- dropdown menu -->
<div *ngIf="menuItem.submenu.length > 0" class="dropdown-menu" ngbDropdownMenu aria-labelledby="i">
<div *ngFor="let menuSubItem of menuItem.submenu">
<a [routerLink]="menuSubItem.path"
[routerLinkActive]="['active-sub']" <== ** this part works and sets the class, now i need the top nav-link to be active too
[routerLinkActiveOptions]="{exact: true}"
class="dropdown-item">
{{menuSubItem.title}}
</a>
</div>
</div>
</li>