Skip to content

Commit

Permalink
docs(material/sidenav): fix sidenav not working (angular#30390)
Browse files Browse the repository at this point in the history
fixes broken example for responsive sidebar which included routerLink directive but is missing router module which prevents sidebar from opening by removing directive as it serve no purpose

fixes angular#30307
  • Loading branch information
naaajii authored and wagnermaciel committed Jan 27, 2025
1 parent 777d1c1 commit 60a3b87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1 class="example-app-name">Responsive App</h1>
[fixedInViewport]="isMobile()" fixedTopGap="56">
<mat-nav-list>
@for (nav of fillerNav; track nav) {
<a mat-list-item routerLink=".">{{nav}}</a>
<a mat-list-item>{{nav}}</a>
}
</mat-nav-list>
</mat-sidenav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ import {MatSidenavModule} from '@angular/material/sidenav';
import {MatIconModule} from '@angular/material/icon';
import {MatButtonModule} from '@angular/material/button';
import {MatToolbarModule} from '@angular/material/toolbar';
import {RouterLink} from '@angular/router';

/** @title Responsive sidenav */
@Component({
selector: 'sidenav-responsive-example',
templateUrl: 'sidenav-responsive-example.html',
styleUrl: 'sidenav-responsive-example.css',
imports: [
MatToolbarModule,
MatButtonModule,
MatIconModule,
MatSidenavModule,
MatListModule,
RouterLink,
],
imports: [MatToolbarModule, MatButtonModule, MatIconModule, MatSidenavModule, MatListModule],
})
export class SidenavResponsiveExample implements OnDestroy {
protected readonly fillerNav = Array.from({length: 50}, (_, i) => `Nav Item ${i + 1}`);
Expand Down

0 comments on commit 60a3b87

Please sign in to comment.