我在 app.component.html 中使用角材料添加了工具栏和侧导航栏。
app.component.html
<div>
<mat-sidenav-container class="main-container">
<mat-sidenav #sideBarRef opened mode="side" [(opened)]='isSideBarOpen'>
<mat-nav-list>
<a mat-list-item href="#"> Home </a>
<a mat-list-item href="#"> Project Updates </a>
<a mat-list-item href="#"> General Updates </a>
<a mat-list-item href="#"> Help </a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar color="primary">
<button (click)='sideBarRef.toggle()'><mat-icon>menu</mat-icon></button>
My Application
</mat-toolbar>
</mat-sidenav-content>
</mat-sidenav-container>
</div>
到目前为止,我的应用程序中只有一个组件,即应用程序组件。现在我想为主页左侧的每个按钮开发不同的组件。当用户单击任何按钮时,我想在这些按钮上显示相应的 html 模板。
我该如何实施?我感谢您的帮助。