0

Currently I'm developing an Angular Web-App using Angular Material. The sidenav works flawlessly but causes a full page refresh every time I open a new router link.

HTML:

<mat-nav-list>
  <a mat-list-item routerLink="/page1" (click)="sidenav.close()">page1</a>
  <a mat-list-item routerLink="/page2" (click)="sidenav.close()">page2</a>
</mat-nav-list>

app.module.ts:

const appRoutes: Routes = [
{ path: 'page1', component: Page1Component},
{ path: 'page2', component: Page2Component},
];

Is there any possibility to deactivate the page refresh?

EciBreci
  • 1
  • 1
  • See [this](https://stackoverflow.com/questions/35274028/stop-mouse-event-propagation-in-angular) SO question and the answers given. – Jeroen Heier Sep 03 '18 at 14:20

1 Answers1

0

Replacing

(click)="sidenav.close()"

with

(click)="drawer.toggle()"

has solved the problem.

EciBreci
  • 1
  • 1