0

I'm using angular 5 and angular material. i have a mat-sidenav-container that consists of mat-sidenav and a mat-sidenav-content. and I have a mat-toolbar in the top of my page. I want to use routerLink in my sidenav-content but it's not working however it works in my mat-toolbar. even a button click function is not working. here are my codes below

<mat-toolbar>
    <mat-toolbar-row>
        <div>
            <button mat-icon-button class="button" (click)="sidemenu.toggle()">
        <mat-icon class="menu">menu</mat-icon>
      </button>
        </div>
        <div mat-card-avatar class="example-header-image"></div>
    </mat-toolbar-row>
</mat-toolbar>
<mat-sidenav-container class="example-container">
    <mat-sidenav mode="side" opened #sidemenu>
        <mat-nav-list>
            <mat-list-item appAccordionLink>
                <a appAccordionToggle>
                    <mat-icon class="list-icon">inbox</mat-icon>
                    <span class="link">IncomingMail</span>
                    <span fxFlex></span>
                </a>
            </mat-list-item>
        </mat-nav-list>
    </mat-sidenav>
    <mat-sidenav-content>
        <a routerLink="/">Home</a>
    </mat-sidenav-content>
    <router-outlet></router-outlet>
</mat-sidenav-container>
Kalamarico
  • 5,466
  • 22
  • 53
  • 70
fariba.j
  • 1,737
  • 7
  • 23
  • 42
  • Do you get any error? "...not working" isn't enough. Try to debug the app and drop more infos/details please. – k.vincent Apr 16 '18 at 09:11
  • I don't get any errors. everything in the sidenav-container such as button or inputs doesn't work – fariba.j Apr 16 '18 at 09:30
  • Even this is not working? – k.vincent Apr 16 '18 at 10:30
  • @k.vincent no it's not working. I can see the button but when I click on it, nothing happens. it happens for input and other elements in HTML. they're not working. should I import a module beside MatSidenavModule? is MatSidenavModule enough? – fariba.j Apr 17 '18 at 09:54
  • What do you mean exactly with "it happens for input and other elements in HTML"? – k.vincent Apr 17 '18 at 10:05
  • @farbia: Can you please add the code to your router code you're using. I mean where you define the routes. – k.vincent Apr 17 '18 at 10:14
  • @k.vincentI mean that even if I use an input, it's not working and I cant type in the input form. is it related to my routes? – fariba.j Apr 17 '18 at 10:21
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/169155/discussion-between-k-vincent-and-fariba-j). – k.vincent Apr 17 '18 at 10:29
  • Let's continue in chat – k.vincent Apr 17 '18 at 10:32

0 Answers0