Closing the Angular Material Sidenav Post Navigation

Ole Ersoy
1 min readOct 15, 2019

--

Photo by Tomas Sobek on Unsplash

Scenario

After clicking on Accounts we want our MatSidenav to close.

Approach

Create a template variable referencing the MatSidenav instance:

<mat-sidenav #sidenav>

When the user selects Accounts close the MatSidenav instance:

(click)="sidenav.toggle()"

Demo

--

--

Ole Ersoy
Ole Ersoy

Written by Ole Ersoy

Founder of Firefly Semantics Corporation

No responses yet