This is the code example being used in angular Material for Sidenav. Im using this very same example on my page. However, I could find any instructions how to open the sidenav from left to right from the right side of the screen. Anybody knows how to ?
<mat-sidenav-container class="example-container">
<mat-sidenav #sidenav mode="side" [(opened)]="opened" (opened)="events.push('open!')"
(closed)="events.push('close!')">
Sidenav content
</mat-sidenav>
<mat-sidenav-content>
<p><mat-checkbox [(ngModel)]="opened">sidenav.opened</mat-checkbox></p>
<p><button mat-button (click)="sidenav.toggle()">sidenav.toggle()</button></p>
<p>Events:</p>
<div class="example-events">
<div *ngFor="let e of events">{{e}}</div>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
Specifying the main and side contentBoth the main and side content should be placed inside of the <mat-sidenav-container> , content that you don't want to be affected by the sidenav, such as a header or footer, can be placed outside of the container. The side content should be wrapped in a <mat-sidenav> element.
close() you get closing only if in over mode. Show activity on this post. Adding (click)="sidenav. close()" along with the routerLink="/whatever/path/here" works.
If you look to the API tab there is an input directive position
for you to define.
position: 'start' | 'end'
The side that the drawer is attached to.
<mat-drawer-container class="example-container">
<mat-drawer #sideNav mode="side" opened="true" position="end">
Right drawer
</mat-drawer>
<mat-drawer-content>
Main content
</mat-drawer-content>
</mat-drawer-container>
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With