Karellism

5. Multi-Menu in Side-Nav

May 4th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

So, in the sidenav-list.component.html file, we need to add the following code below the last anchor tag:

<mat-list-item [matMenuTriggerFor]="menu">
<mat-icon>unfold_more</mat-icon>
<a matline>Example</a>
</mat-list-item>
<mat-menu #menu="matMenu">
<button mat-menu-item (click)="onSidenavClose()">View profile</button>
<button mat-menu-item (click)="onSidenavClose()">Add contact</button>
</mat-menu>

For this to work, we need to register MatMenuModule:

import { …, MatMenuModule } from '@angular/material';

imports: [
MatMenuModule,

exports: [
MatMenuModule,

Add Comment
Please, Sign In to add comment