我正在为“菜单扩展面板”工作。我正在尝试执行以下示例: 默认情况下,该面板应该关闭,但是当我单击任何链接时,当其路由到其他页面时,该面板应该展开。当我单击任何其他面板时,相应的面板也应该关闭。 路由到其他页面时,面板关闭,我遇到问题。 下面是代码:
<mat-sidenav #sidemenu class="sidenav sidebar"
[attr.role]="(isHandset$ | async)? 'dialog':'navigation'"
[mode]="(isHandset$ | async)? 'over':'side'"
[opened]="(isHandset$ | async)" >
<mat-nav-list>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title>
<a routerLink="/user" [routerLinkActive]="['active']"> User</a>
</mat-panel-title>
</mat-expansion-panel-header>
<ul>
<a routerLink="/loginUser" [routerLinkActive]="['active']"> Login </a>
</ul>
<ul>
<a routerLink="/signInUser" [routerLinkActive]="['active']"> Sign In </a>
</ul>
</mat-expansion-panel>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title>
<a routerLink="/Operator" [routerLinkActive]="['active']"> Operator </a>
</mat-panel-title>
</mat-expansion-panel-header>
<ul>
<a routerLink="/login" [routerLinkActive]="['active']"> Login </a>
</ul>
<ul>
<a routerLink="/signIn" [routerLinkActive]="['active']"> Sign In </a>
</ul>
</mat-expansion-panel>
</mat-nav-list>
</mat-sidenav>