简体   繁体   English

mat-sidenav-container 在 dom 中始终为空

[英]mat-sidenav-container always empty in dom

I'm trying to create a sidebar for my angular application using functionality from the @angular/material package.我正在尝试使用@angular/material package 的功能为我的 angular 应用程序创建一个侧边栏。

I've tried out multiple ways to add the sidebar to by application but it remains empty/not showing up.我已经尝试了多种方法来通过应用程序添加侧边栏,但它仍然是空的/不显示。

 <mat-sidenav-container> <mat-sidenav #sidenav> <mat-nav-list> <a mat-list-item > Accounts </a> <a mat-list-item > Create Account </a> <a mat-list-item > Contacts </a> <a mat-list-item > Create Contact </a> <a mat-list-item > Activities </a> <a mat-list-item > Create Activity </a> <a mat-list-item (click)="sidenav.toggle()" href="" mat-list-item>Close</a> </mat-nav-list> </mat-sidenav> <mat-sidenav-content> <div style="height: 88vh;"> content </div> </mat-sidenav-content> </mat-sidenav-container>

This is the code I'm using in my html template file.这是我在 html 模板文件中使用的代码。

This is the resulting dom:这是生成的dom:

在此处输入图像描述

I have no idea why nothing is there inside the mat-sidenav-container.我不知道为什么 mat-sidenav-container 里面什么都没有。 I'm using angular 9 and created this project with the CLI.我正在使用 angular 9 并使用 CLI 创建了这个项目。

Any help would be appreciated!任何帮助,将不胜感激!

Importing BrowserAnimationsModule solved this problem for me.导入BrowserAnimationsModule为我解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM