我正在尝试创建"右侧导航栏"角材料2 md-sidenav
。无论我做什么,它总是在左边。我怎样才能改为右侧呢?
<md-sidenav #sidenavright mode="side" class="app-sidenav" opened="true">
<app-question-rightnav></app-question-rightnav>
</md-sidenav>
答案 0 :(得分:25)
好吧,这比我想象的容易,傻傻的我!!
要将md-sidenav对齐到右侧,只需将align="end"
添加到md-sidenav
元素。
<md-sidenav align="end" #sidenavright mode="side" class="app-sidenav" opened="true">
<app-question-rightnav></app-question-rightnav>
</md-sidenav>
在更高版本中,它已更改为position="end"
示例强>
<mat-sidenav #sidenavright position="end">
Right sideNav
</mat-sidenav>
答案 1 :(得分:6)
<mat-sidenav-container>
<mat-sidenav #right position="start">
Start Sidenav.
</mat-sidenav>
<mat-sidenav #left position="end">
End Sidenav.
</mat-sidenav>
<div>
<button mat-button (click)="right.open()">right</button>
<button mat-button (click)="left.open()">left</button>
</div>
</mat-sidenav-container>